bloc_abstraction 1.0.0

[discontinued]

Simple abstraction for Flutter's BloC pattern implementation

bloc_abstraction #

Simple abstraction for Flutter's BloC pattern implementation

Create BloC #

Create a BloC extending BlocBase

class CounterBloc extends BlocBase {
  @override
  void dispose() {
    // TODO: implement dispose
  }
}

Use dispose() method to close your streams and cancel your StreamSubscription

Using BlocProvider #

Create a BlocProvider like this by passing bloc and widget

class HomeView extends StatelessWidget {
  final bloc = CounterBloc();

  @override
  Widget build(BuildContext context) {
    return BlocProvider(
      bloc: bloc,
      child: Scaffold(
        appBar: AppBar(
          title: Text("Title"),
        ),
        body: Info(),
      ),
    );
  }
}

That will grant you to get bloc inside the widget tree anywhere

class Info extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final bloc = BlocProvider.bloc<CounterBloc>(context);
0
likes
0
pub points
41%
popularity

Simple abstraction for Flutter's BloC pattern implementation

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

tercyostorck@gmail.com

More

Packages that depend on bloc_abstraction