dash 0.5.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 89

Dash #


Dash is a simple but efficient library that provides BloCs class without headaches.

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();

  void dispose() {

Changelog #

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

[0.5.3] - March/2019

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

[0.5.2] - March/2019

  • Updated documentation

[0.5.1] - March/2019

  • Improves the dispose function
  • Updated example


import 'package:dash/dash.dart';

import 'provider.dart';

class Main {
  init() {
    BlocSample _bloc = Provider.of<BlocSample>();

  dispose() {

class BlocSample extends Bloc {
  String test = 'BlocSample';

  static BlocSample instance() => BlocSample();

  load() {
    //load initial data

  dispose() {
    //close streams

Use this package as a library

1. Depend on it

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

  dash: ^0.5.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter 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/dash.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 Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dash/dash.dart.

Health suggestions

Format lib/dash.dart.

Run dartfmt to format lib/dash.dart.

Format lib/src/annotations.dart.

Run dartfmt to format lib/src/annotations.dart.

Format lib/src/bloc.dart.

Run dartfmt to format lib/src/bloc.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
pedantic 1.4.0
test ^1.0.0