doc(bloc_helper): update readme

This commit is contained in:
Malo Léon 2022-07-14 11:55:49 +01:00
parent efda077f4b
commit 61c6e637ec

View File

@ -116,6 +116,19 @@ Widget onBuild(BuildContext context, CounterState state) {
} }
``` ```
If needed, you can wrap what depends on the state with the function `onWrap`.
```dart
@override
Widget onWrap(BuildContext context, Widget child) {
return Scaffold(
appBar: AppBar(
title: const Text('Title'),
),
body: child,
);
```
> Note: you can override `onBuild`, but also `onListen`, `shouldBuildWhen` and `shouldListenWhen` methods. > Note: you can override `onBuild`, but also `onListen`, `shouldBuildWhen` and `shouldListenWhen` methods.
### Both BlocProvider and BlocConsumer ### Both BlocProvider and BlocConsumer