flutter_built_bloc 0.3.1 flutter_built_bloc: ^0.3.1 copied to clipboard
Generates the BLoC boilerplate.
flutter_built_bloc #
Helper widgets for adopting the BLoC pattern in combination with built_bloc
BlocProvider #
Create a BlocProvider
and give him your Bloc
.
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(blocBuilder:(c) => ExampleBloc(), child: ExampleView());
}
}
You can then access it with the BlocProvider.of
method :
class ExampleView extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bloc = BlocProvider.of<ExampleBloc>(context);
// ...
}
}
Note #
Under the hood, the provider package is used, so you have access to all its APIs.
How to use #
Install #
dependencies:
flutter_built_bloc: