dartodef 0.1.4

  • README.md
  • Installing
  • Versions
  • 75

dartodef

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

**pubspec.yaml**

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

1. Depend on it

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


dependencies:
  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 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 failed Download dartodef 0.1.1 archive
0.1.0 Dec 5, 2013 failed Download dartodef 0.1.0 archive

Analysis

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

  • Dart: 2.0.0-dev.46.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0
analyzer >=0.28.0 <0.31.0 0.30.0+4 0.31.1
barback >=0.14.0 <0.16.0 0.15.2+15
source_maps >=0.10.0 <0.11.0 0.10.4
source_span >=1.0.3 <2.0.0 1.4.0
Transitive dependencies
args 1.4.1
async 2.0.6
charcode 1.1.1
cli_util 0.1.2+1
collection 1.14.9
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
front_end 0.1.0-alpha.4.1 0.1.0-alpha.11
glob 1.1.5
html 0.13.3
isolate 1.1.0 2.0.0
kernel 0.3.0-alpha.1.1 0.3.0-alpha.11
logging 0.11.3+1
meta 1.1.2
package_config 1.0.3
path 1.5.1
plugin 0.2.0+2
pool 1.3.4
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
yaml 2.1.13
Dev dependencies
test ^0.12.0