flutter_bloc_stream 6.0.1 copy "flutter_bloc_stream: ^6.0.1" to clipboard
flutter_bloc_stream: ^6.0.1 copied to clipboard

Helper package for using bloc_stream with Flutter. Includes BlocStreamProvider and BlocStreamBuilder.

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

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}");
});
0
likes
150
points
121
downloads

Publisher

verified publishertimsmart.co

Weekly Downloads

Helper package for using bloc_stream with Flutter. Includes BlocStreamProvider and BlocStreamBuilder.

Repository (GitLab)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

bloc_stream, flutter, flutter_hooks, provider

More

Packages that depend on flutter_bloc_stream