smoke 0.3.6+3

  • Readme
  • Changelog
  • Installing
  • 16

Smoke (and mirrors) #

Smoke is a package that exposes a reduced reflective system API. This API includes accessing objects in a dynamic fashion (read properties, write properties, and call methods), inspecting types (for example, whether a method exists), and symbol/string convertion.

The package provides a default implementation of this API that uses the system's mirrors, but additionally provides mechanisms for statically generating code that can replace the mirror-based implementation.

The intention of this package is to allow frameworks to use mirrors in a way that will not impose on their users. The idea is that users will not worry about how to preserve symbols when compiling with dart2js (for instance, using the MirrorsUsed annotation). Instead, this package provides the building blocks to autogenerate whatever is needed for dart2js to be happy and to generate reasonable code.

Note this package alone doesn't know how to generate everything, but it provides a simple API that different frameworks can use to define what needs to be generated.

Smoke reflective API #

Use package:smoke/smoke.dart in your framework to read and write objects and to inspect type information. Read the Dart-docs for more details.

Code Generation #

Use package:smoke/codegen/generator.dart and package:smoke/codegen/recorder.dart in your transformer to create a static initialization that can be used by smoke. The test under test/codegen/end_to_end_test.dart is a good illustrating example to learn how to use these APIs.


  • Eliminate errors reported by analyzer in strong mode.


  • Update to use the transformer_test package instead of code_transformers for tests.


  • Update to analyzer '^0.27.0' and update to the test package.


  • Update to analyzer '<0.27.0'


  • Add excludeOverriden to QueryOptions which removes declarations that were overriden within the class hierarchy.


  • Update logging package to <0.12.0.


  • Update to analyzer <0.26.0.


  • Work around an issue running Dart analyzer on the generated code, if the dynamic type appeared in the output. Smoke will now use Object instead.


  • Updated dependency versions.


  • Add canAcceptNArgs method.


  • Change SUPPORTED_ARGS limit for minArgs and maxArgs method from 3 to 15.


  • Fix toString calls on Type instances.


  • Widen the constraint on analyzer.


  • Widen the constraint on barback.


  • Switch from source_maps' Span class to source_span's SourceSpan class.


  • Static configuration can be modified, so code generators can split the static configuration in pieces.
  • breaking change: for codegen call writeStaticConfiguration instead of writeInitCall.


  • Initial release: introduces the smoke API, a mirror based implementation, a statically configured implementation that can be declared by hand or be generated by tools, and libraries that help generate the static configurations.

Use this package as a library

1. Depend on it

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

  smoke: ^0.3.6+3

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:smoke/smoke.dart';
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.

This package is not analyzed, because it is discontinued.

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

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.12.0 <2.0.0