dart_builder 0.1.1

  • README.md
  • Installing
  • Versions
  • 0

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.

Use this package as a library

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
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 Because dart_builder depends on quiver >=0.3.0 <=0.29.0+1 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/src/elements/definition/class.dart.

Run dartfmt to format lib/src/elements/definition/class.dart.

Format lib/src/elements/definition/field.dart.

Run dartfmt to format lib/src/elements/definition/field.dart.

Format lib/src/elements/definition/method.dart.

Run dartfmt to format lib/src/elements/definition/method.dart.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/elements/definition/parameter.dart (Run dartfmt to format lib/src/elements/definition/parameter.dart.)
  • lib/src/elements/directive.dart (Run dartfmt to format lib/src/elements/directive.dart.)
  • lib/src/elements/invoke/array.dart (Run dartfmt to format lib/src/elements/invoke/array.dart.)
  • lib/src/elements/invoke/call.dart (Run dartfmt to format lib/src/elements/invoke/call.dart.)
  • lib/src/elements/invoke/map.dart (Run dartfmt to format lib/src/elements/invoke/map.dart.)
  • lib/src/elements/source.dart (Run dartfmt to format lib/src/elements/source.dart.)
  • lib/src/elements/type.dart (Run dartfmt to format lib/src/elements/type.dart.)
  • lib/src/file.dart (Run dartfmt to format lib/src/file.dart.)

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Package is too old. (-100 points)

The package was released more than two years ago.

Maintain CHANGELOG.md. (-20 points)

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

The description is too short. (-20 points)

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

Maintain an example. (-10 points)

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.