dash_generator 0.4.0

  • README.md
  • Example
  • Installing
  • Versions
  • new52

Dash Generator #


Generates provider source code using dash library.

IMPORTANT: Dart2 is required to use this package.

Installation #

  • Add dash to your pubspec.yaml under the dependencies section:
  dash: ^latest_version
  • Add build_runner and dash_generator to your pubspec.yaml under the dev_dependencies section:
  build_runner: ^1.1.3
  dash_generator: ^latest_version

Usage #

1 - Create a provider class that is going to gathering all BlocProvider annotation:

IMPORTANT: Do not forget to add: part 'provider.g.dart';.

import 'package:dash/dash.dart';

part 'provider.g.dart';

abstract class Provider {}

2 - Extends all your bloc class from Bloc. It will allow you to override disposable and dispose method.

IMPORTANT: In order to cache bloc class it must has an unique ID that is represented by a static string property named as key. Also an instance() function that returns the instance of the bloc class as show bellow is necessary.

class MySampleBloc extends Bloc {
  static final String key = 'MySampleBloc-uid';

  bool disposable() {
    return true;

  dispose() {
    //close all streams

  static Bloc instance() {
    return MySampleBloc();

class MyOtherBloc extends Bloc {
  static final String key = 'MyOtherBloc-uid';

  bool disposable() {
    return true;

  dispose() {
    //close all streams

  static Bloc instance() {
    return MyOtherBloc();

3 - Run build_runner, it will generate the provider.g.dart class that you added as part on your provider class.

On project directory run on terminal:

pub run build_runner build

For flutter is:

flutter packages pub run build_runner build

Note: If you encounter a conflict error, please add the --delete-conflicting-outputs argument to your command:

flutter packages pub run build_runner build --delete-conflicting-outputs

4 - Finally you can get your bloc class instance from wherever you want, example:

  Widget build(BuildContext context) {
    final _bloc = $Provider.of<MyOtherBloc>();

    return Container();

Changelog #

Please see the Changelog page to know what's recently changed.

[0.4.0] - February second 2019.

  • Changed the way of how blocs are disposed


import 'bloc_example.dart';
import 'provider.dart';

class Main {
  void anyMethod() {
    final bloc = $Provider.of<BlocExample>();

Use this package as a library

1. Depend on it

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

  dash_generator: ^0.4.0

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:dash_generator/dash_generator.dart';
Version Uploaded Documentation Archive
0.4.0 Feb 8, 2019 Go to the documentation of dash_generator 0.4.0 Download dash_generator 0.4.0 archive
0.3.0 Feb 3, 2019 Go to the documentation of dash_generator 0.3.0 Download dash_generator 0.3.0 archive
0.2.0 Feb 3, 2019 Go to the documentation of dash_generator 0.2.0 Download dash_generator 0.2.0 archive
0.1.0 Jan 28, 2019 Go to the documentation of dash_generator 0.1.0 Download dash_generator 0.1.0 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 Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1


Detected platforms: other

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


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
build ^1.1.0 1.1.1
code_builder ^3.1.3 3.2.0
dash ^0.4.0 0.4.0
source_gen ^0.9.4 0.9.4+1
Transitive dependencies
analyzer 0.35.1
args 1.5.1
async 2.0.8
built_collection 4.1.0
built_value 6.3.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
csslib 0.14.6
dart_style 1.2.3
fixnum 0.10.9
front_end 0.1.11
glob 1.1.7
html 0.13.3+3
kernel 0.3.11
logging 0.11.3+2
matcher 0.12.4
meta 1.1.7
package_config 1.0.5
path 1.6.2
plugin 0.2.0+3
pub_semver 1.4.2
quiver 2.0.1
source_span 1.5.4
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
yaml 2.1.15
Dev dependencies
build_runner ^1.1.3
build_test ^0.10.0