dartodef 0.1.4

  • README.md
  • Installing
  • Versions
  • 75


dartodef is a transformer (preprocessor) for pub build which replaces variable values on compile-time. The values can be defined in the pubspec.yaml. For different environment values create a property in the transformer options for dartodef and pass the name of the property as environment variable to the

## Setup dartodef


name: dartodef_sample_setup version: 0.1.0 dependencies: browser: any js: any dartodef: any transformers:

  • dartodef: live: environment: 'live' doIt: true preview: environment: 'preview' doIt: false

**main.dart** (for example)

library sample_app;

import 'package:dartodef/dartodef.dart';

@Definition(name:'environment') const String ENV = 'development';

class Test { @Definition(name:'doIt') static bool done = false; }

Running pub build now:

DARTODEF=live pub build

If no environment is set the default values will be used.

## Available types

... transformers:

  • dartodef: live: string: hallo other_string: "hallo test" int: 1 num: 1 double: 1.1 bool: true list: [1, 2, "simple", 1.1, true] map: key: "value" key2: 1

Only simple types can be used. Lists and maps will be serialized.

## What you need to know

- always import dartodef as it is. DO NOT USE "as"
- only variables that are already initialized can be used. And the initialization needs to match the type (for example mapping on string when code looks like: "String variable = null;" failes)
- use const if you want to make sure that dead is removed

## Plans for the future

- load values for each environment from dart scripts or other external files (JSON, YAML)

### How to run tests

DARTODEF=test pub serve --port=4444 test/ pub run test --pub-serve=4444

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  dartodef: "^0.1.4"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:dartodef/dartodef.dart';
Version Uploaded Documentation Archive
0.1.4 Aug 26, 2017 Go to the documentation of dartodef 0.1.4 Download dartodef 0.1.4 archive
0.1.3 Apr 8, 2017 Go to the documentation of dartodef 0.1.3 Download dartodef 0.1.3 archive
0.1.2 Nov 20, 2016 Go to the documentation of dartodef 0.1.2 Download dartodef 0.1.2 archive
0.1.1 Jan 24, 2014 Go to the documentation of dartodef 0.1.1 Download dartodef 0.1.1 archive
0.1.0 Dec 5, 2013 Go to the documentation of dartodef 0.1.0 Download dartodef 0.1.0 archive


We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
74 / 100
Code health derived from static analysis. [more]
75 / 100
Reflects how tidy and up-to-date the package is. [more]
79 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dartodef/dartodef.dart.


  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 error 9 hints.

    Strong-mode analysis of lib/transformer.dart failed with the following error:

    line: 182 col: 38
    The getter 'value' isn't defined for the class 'Expression'.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dartodef.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0
analyzer >=0.28.0 <0.31.0 0.30.0+4 0.32.1
barback >=0.14.0 <0.16.0 0.15.2+16
source_maps >=0.10.0 <0.11.0 0.10.5
source_span >=1.0.3 <2.0.0 1.4.0
Transitive dependencies
args 1.4.3
async 2.0.7
charcode 1.1.1
cli_util 0.1.3
collection 1.14.10
convert 2.0.1
crypto 2.0.5
csslib 0.14.4
front_end 0.1.0-alpha.4.1 0.1.1
glob 1.1.5
html 0.13.3+1
isolate 1.1.0 2.0.1
kernel 0.3.0-alpha.1.1 0.3.1
logging 0.11.3+1
meta 1.1.5
package_config 1.0.3
path 1.6.1
plugin 0.2.0+2
pool 1.3.5
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+8
yaml 2.1.14
Dev dependencies
test ^0.12.0