dart_builder 0.1.1

  • README.md
  • Installing
  • Versions
  • 41

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:


dependencies:
  dart_builder: "^0.1.1"

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: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

Analysis

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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dart_builder/dart_builder.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 2 errors 11 hints.

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

    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)'.

    Similar analysis of the following files failed:

    • lib/src/elements/definition/class.dart (hint)
    • lib/src/elements/definition/field.dart (hint)
    • lib/src/elements/definition/parameter.dart (hint)
    • lib/src/elements/invoke/array.dart (hint)
    • lib/src/elements/invoke/call.dart (hint)
    • lib/src/elements/invoke/map.dart (hint)
    • lib/src/elements/source.dart (hint)
    • lib/src/elements/type.dart (hint)
    • lib/src/file.dart (hint)
  • 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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
dart_style >=0.1.8 <0.2.0 0.1.8+2 1.0.14
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.29.0+1
Transitive dependencies
analyzer 0.25.2+1 0.32.0
args 0.13.7 1.4.3
async 2.0.7
charcode 1.1.1
collection 1.14.9
csslib 0.13.7+1 0.14.4
html 0.12.2+2 0.13.3
logging 0.11.3+1
matcher 0.12.2+1
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