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
130
pub points
31%
popularity

Publisher

verified publishertimsmart.co

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