dart_builder 0.1.1

  • README.md
  • Installing
  • Versions
  • 28

Dart Builder

Build Status

Getting Started

The most common scenario is creating a new generated file in a transformer or build step. Dart builder provides the SourceFile class to output either a library or a part file (of another library):

var file = new SourceFile.library('bar');
file.toSource(); // Outputs "library bar;\n"

It's possible to import other libraries or files:

new SourceFile.library('bar', imports: [
  new ImportDirective(Uri.parse('package:foo/foo.dart'))

And include other dart constructs, like classes or methods:

new SourceFile.library('bar', topLevelElements: [
  new ClassRef('Foo')

NOTE: By default, SourceFile.toSource() applies the dart formatter.

Creating a class

new ClassRef('Foo', fields: [
  new FieldRef('bar')
], methods: [
  new MethodRef('baz')

See tests for more examples.

1. Depend on it

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

  dart_builder: "^0.1.1"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:dart_builder/dart_builder.dart';
Version Uploaded Documentation Archive
0.1.1 Jun 23, 2015 Go to the documentation of dart_builder 0.1.1 Download dart_builder 0.1.1 archive
0.1.0 Jun 22, 2015 Go to the documentation of dart_builder 0.1.0 Download dart_builder 0.1.0 archive
2.0.0-alpha.4 Apr 13, 2016 Go to the documentation of dart_builder 2.0.0-alpha.4 Download dart_builder 2.0.0-alpha.4 archive
2.0.0-alpha.3 Dec 17, 2015 Go to the documentation of dart_builder 2.0.0-alpha.3 Download dart_builder 2.0.0-alpha.3 archive
0.0.1-alpha.2 Jun 21, 2015 Go to the documentation of dart_builder 0.0.1-alpha.2 Download dart_builder 0.0.1-alpha.2 archive
0.0.1-alpha.1 Jun 20, 2015 Go to the documentation of dart_builder 0.0.1-alpha.1 Download dart_builder 0.0.1-alpha.1 archive


This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Feb 16, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1


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


Detected platforms: other

Primary library: package:dart_builder/dart_builder.dart with components: io, mirrors.


  • Fix lib/src/elements/directive.dart.

    Strong-mode analysis of lib/src/elements/directive.dart failed with the following error:

    line: 68 col: 11
    super call must be last in an initializer list (see https://goo.gl/EY6hDP): 'super(uri)'.

  • Fix lib/src/elements/definition/method.dart.

    Strong-mode analysis of lib/src/elements/definition/method.dart failed with the following error:

    line: 118 col: 15
    The argument type '(ParameterRef, StringSink) → Null' can't be assigned to the parameter type '(Source, StringSink) → void'.

  • Maintain CHANGELOG.md.

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

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 2 error(s) and 0 warning(s).

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

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


Package Constraint Resolved Available
Direct dependencies
dart_style >=0.1.8 <0.2.0 0.1.8+2 1.0.9+1
mustache >=0.2.3 <0.3.0 0.2.5+1 1.0.0
quiver >=0.21.4 <0.22.0 0.21.4 0.28.0
Transitive dependencies
analyzer 0.25.2+1 0.31.1
args 0.13.7 1.3.0
async 2.0.3 2.0.4
charcode 1.1.1
collection 1.14.5
csslib 0.13.7+1 0.14.1
html 0.12.2+2 0.13.2+2
logging 0.11.3+1
matcher 0.12.1+4
package_config 0.1.5 1.0.3
path 1.5.1
plugin 0.1.0 0.2.0+2
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
utf 0.9.0+4
watcher 0.9.7+7
yaml 2.1.13
Dev dependencies
test any