widgetsBindingObserver<R> static method
StateWithMixinBuilder<WidgetsBindingObserver, R>
widgetsBindingObserver<R>({
- Key? key,
- dynamic tag,
- ReactiveModel<
R> observe()?, - Widget builder(
- BuildContext context,
- ReactiveModel<
R> ? rm
- Widget builderWithChild(
- BuildContext context,
- ReactiveModel<
R> ? rm, - Widget? child
- Widget? child,
- void initState(
- BuildContext context,
- ReactiveModel<
R> ? rm
- void dispose(
- BuildContext context,
- ReactiveModel<
R> ? rm
- void didChangeDependencies(
- BuildContext context,
- ReactiveModel<
R> ? rm
- void didUpdateWidget(
- BuildContext context,
- StateWithMixinBuilder<
WidgetsBindingObserver, R> old
- void afterInitialBuild(
- BuildContext context,
- ReactiveModel<
R> ? rm
- void afterRebuild(
- BuildContext context,
- ReactiveModel<
R> ? rm
- void didChangeAppLifecycleState(
- BuildContext context,
- AppLifecycleState lifecycleState
- void didChangeLocales(
- BuildContext context,
- List<
Locale> ? locale
StateBuilder mixin with WidgetsBindingObserver
- Required parameters:
builder
: The builder callback to be executed whenever the widget is notified.builderWithChild
: The builder callback to be executed whenever the widget is notified. It must be use withchild
parameter.child
: Widget to be used withbuilderWithChild
. Used for optimization.builder
or and only orbuilderWithChild
withchild
must be defined.
- Optional parameters:
observe
: The model to observer.observeMany
Callback to be called when the widget is first inserted.dispose
: Callback to be called when the widget is removed.didChangeDependencies
: Callback to be called when dependencies changed.didUpdateWidget
: Callback to be called when the widget updatedafterInitialBuild
: Callback to be called after the first build of the widget.afterRebuild
: Callback to be called after each build.didChangeAppLifecycleState
: Called when the system puts the app in the background or returns the app to the foreground.didChangeLocales
: Called when the system tells the app that the user's locale has changed. For example, if the user changes the system language settings..
Implementation
static StateWithMixinBuilder<WidgetsBindingObserver, R>
widgetsBindingObserver<R>({
Key? key,
dynamic tag,
ReactiveModel<R> Function()? observe,
Widget Function(BuildContext context, ReactiveModel<R>? rm)? builder,
Widget Function(BuildContext context, ReactiveModel<R>? rm, Widget? child)?
builderWithChild,
Widget? child,
void Function(BuildContext context, ReactiveModel<R>? rm)? initState,
void Function(BuildContext context, ReactiveModel<R>? rm)? dispose,
void Function(BuildContext context, ReactiveModel<R>? rm)?
didChangeDependencies,
void Function(
BuildContext context,
StateWithMixinBuilder<WidgetsBindingObserver, R> old,
)?
didUpdateWidget,
void Function(BuildContext context, ReactiveModel<R>? rm)?
afterInitialBuild,
void Function(BuildContext context, ReactiveModel<R>? rm)? afterRebuild,
void Function(BuildContext context, AppLifecycleState lifecycleState)?
didChangeAppLifecycleState,
void Function(BuildContext context, List<Locale>? locale)? didChangeLocales,
}) {
return StateWithMixinBuilder<WidgetsBindingObserver, R>(
mixinWith: MixinWith.widgetsBindingObserver,
key: key,
observe: observe,
builder: builder,
builderWithChild: builderWithChild,
child: child,
initState: initState != null
? (context, rm, mix) => initState(context, rm)
: null,
dispose:
dispose != null ? (context, rm, mix) => dispose(context, rm) : null,
didChangeDependencies: didChangeDependencies != null
? (context, rm, mix) => didChangeDependencies(context, rm)
: null,
didUpdateWidget: didUpdateWidget != null
? (context, old, mix) => didUpdateWidget(context, old)
: null,
afterInitialBuild: afterInitialBuild,
afterRebuild: afterRebuild,
didChangeAppLifecycleState: didChangeAppLifecycleState,
didChangeLocales: didChangeLocales,
);
}