flutter_bloc_stream

Last updated:

0 purchases

flutter_bloc_stream Image
flutter_bloc_stream Images
Add to Cart

Description:

flutter bloc stream

flutter_bloc_stream #
This package provides two helpers to help reduce boilerplate when working with
bloc_stream:
BlocStreamProvider #
This is a simple wrapper around the Provider package that automatically
disposes BlocStreams for you.
// Create a provider
BlocStreamProvider(
create: (context) => CounterBloc(),
child: myApp,
);

// Consume in a child context.
final counter = BlocStreamProvider.of<CounterBloc>(context);
copied to clipboard
BlocStreamBuilder #
A simple wrapper around StreamBuilder for building a widget tree when the data
changes. If the bloc parameter then it will automatically look for the BLoC
using BlocStreamProvider.of:
BlocStreamBuilder<CounterBloc, int>(builder: (context, snapshot) {
if (snapshot.hasError) return Text("Fail.");
else if (!snapshot.hasData) return Container();

return Text("${snapshot.data}");
});
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.