dart_builder 0.1.1

  • README.md
  • Installing
  • Versions
  • 39

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.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8


Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

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.

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Maintain CHANGELOG.md.

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

Add SDK constraint in pubspec.yaml.

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

Package is too old.

The package was released more than two years ago.

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 of the 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.

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.

Fix additional 9 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/elements/definition/method.dart (Run dartfmt to format lib/src/elements/definition/method.dart.)
  • 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.)