bloc_widgets
is a Flutter package that provides an alternative to the ConsumerWidget
from the riverpod
package specifically designed for the flutter_bloc
package.
It simplifies the integration of blocs and widgets by extending StatelessWidget, overriding build method and providing buildWithBloc
instead, which should be using to build widget for given state.
BlocConsumerWidget
additionally provides listenWhen
,buildWhen
,listen
methods which BlocConsumer
is using.
BlocBuilderWidget
additionally provides buildWhen
method which BlocBuilder
is using.
BlocListenerWidget
additionally provides listenWhen
method which BlocListener
is using.
SelectorWidget
additionally provides selector
method which BlocSelector
is using .
Those widgets support Bloc
and Cubit
as well.
- Wrapping
BlocConsumer
functionality intoBlocConsumerWidget
- Wrapping
BlocBuilder
functionality intoBlocBuilderWidget
- Wrapping
BlocListener
functionality intoBlocListenerWidget
- Wrapping
BlocSelector
functionality intoBlocSelectorWidget
Add bloc_widgets
as a dependency in your pubspec.yaml
file:
dependencies:
bloc_widgets: ^1.1.2
Contributions to bloc_widgets
are welcome! If you find a bug or want to suggest an improvement, please create an issue or submit a pull request on the GitHub repository.
bloc_widgets
package is released under the MIT License. See the LICENSE file for more details.