dash_generator 0.5.6

  • Readme
  • Changelog
  • Installing
  • 70

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 dispose method.

IMPORTANT: All bloc class must has an instance() function that returns the instance of the bloc class as bellow.

class MySampleBloc extends Bloc {

  dispose() {
    //close all streams

  static Bloc instance() => MySampleBloc();

class MyOtherBloc extends Bloc {

  dispose() {
    //close all streams

  static Bloc instance() => 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.5.6] - Dezember/2019 #

  • Removed analyzer and changed to sample directory

[0.5.5] - November/2019 #

  • Removed test specific version dependency and used from flutter_test sdk

[0.5.4] - November/2019 #

  • Updated dependency packages versions

[0.5.3] - March/2019 #

  • Added LICENSE
  • Formated code
  • Updated reademe
  • Run analyses
  • Added test

[0.5.2] - March/2019 #

  • Updated dash version

[0.5.1] - March/2019 #

  • Improves the code generation

Use this package as a library

1. Depend on it

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

  dash_generator: ^0.5.6

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';
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 Apr 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/bloc_provider_generator.dart. (-1.49 points)

Analysis of lib/src/bloc_provider_generator.dart reported 3 hints:

line 6 col 8: Don't import implementation files from another package.

line 82 col 65: 'name' is deprecated and shouldn't be used. Check element, or use getDisplayString().

line 112 col 58: 'name' is deprecated and shouldn't be used. Check element, or use getDisplayString().

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dash_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
build ^1.2.2 1.2.2
built_collection ^4.3.0 4.3.2
code_builder ^3.2.1 3.2.1
dart_style ^1.3.3 1.3.4
dash ^0.5.6 0.5.7
source_gen ^0.9.4+6 0.9.5
Transitive dependencies
_fe_analyzer_shared 2.1.0
analyzer 0.39.6
args 1.6.0
async 2.4.1
built_value 7.0.9
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
fixnum 0.10.11
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
logging 0.11.4
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
path 1.6.4
pub_semver 1.4.4
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+14
yaml 2.2.0
Dev dependencies
build_runner ^1.7.2
pedantic ^1.8.0+1 1.9.0