no_bloc_flutter 0.13.1 no_bloc_flutter: ^0.13.1 copied to clipboard
Making blocs easy again. A simplified library for the original bloc approach.
Helper widgets to work with no_bloc
library
Bloc Builder #
Keeps your UI in sync with the State of your app. It's StatelessWidget widget which only rebuilds the relative child, instead of rebuilding entire page.
BlocBuilder<BlocType, BlocStateType>(
bloc: bloc
onUpdate: (context, data) => Text(data.toString()),
onBusy: (_) => Text('Working'),
onError: (_, e) => Text('Error Occurred'),
)
Or a simpler version (extension method sugar):
bloc.builder(
onUpdate: (context, data) => Text(data.toString()),
onError: (_, e) => Text('Error Occurred: $e'),
)
for details see example
Bloc Container #
A container where you can store all your blocs on app startup, and then access them anywhere in your app independently of the widget tree.
void main() {
BlocContainer.add((context, args) => CounterBloc(args));
final counterBloc = BlocContainer.get(arg: 0);
}
Bloc List Builder #
A builder which builds a ListView widget backed by a data source e.g. an infinite scrollable list backed by a rest api example coming soon
Contribution ❤ #
Issues and pull requests are welcome
Please file feature requests and bugs at the issue tracker.