dash 0.3.0 copy "dash: ^0.3.0" to clipboard
dash: ^0.3.0 copied to clipboard

outdated

Dash library is responsible to offer a BlocProvider pattern that cares about dispose all the streams of blocs.

example/dash_example.dart

import 'package:dash/dash.dart';

class Main {
  void anyMethod() {
    BlocSample _bloc = Provider.of<BlocSample>();
  }
}

class Provider {
  static T of<T extends Bloc>([List<String> keepBlocs = const []]) {
    switch (T) {
      case BlocSample:
        {
          return BlocCache.getBlocInstance(
              keepBlocs, BlocSample.key, () => BlocSample.instance());
        }
    }
    return null;
  }
}

class BlocSample extends Bloc {
  String test = 'BlocSample';
  static final String key = 'BlocSample';

  static BlocSample instance() => BlocSample();

  @override
  bool disposable() {
    return false;
  }

  @override
  dispose() {
    //close streams
  }
}
9
likes
0
pub points
79%
popularity

Publisher

unverified uploader

Dash library is responsible to offer a BlocProvider pattern that cares about dispose all the streams of blocs.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on dash