widgetsBindingObserver<R> method Null safety

StateWithMixinBuilder<WidgetsBindingObserver, R> widgetsBindingObserver<R>(
  1. {Key? key,
  2. dynamic tag,
  3. InjectedBaseState<R> observe(
      )?,
    1. Widget builder(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    2. Widget builderWithChild(
      1. BuildContext context,
      2. Injected<R>? rm,
      3. Widget? child
      )?,
    3. Widget? child,
    4. void initState(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    5. void dispose(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    6. void didChangeDependencies(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    7. void didUpdateWidget(
      1. BuildContext context,
      2. StateWithMixinBuilder<WidgetsBindingObserver, R> old
      )?,
    8. void afterInitialBuild(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    9. void afterRebuild(
      1. BuildContext context,
      2. Injected<R>? rm
      )?,
    10. void didChangeAppLifecycleState(
      1. BuildContext context,
      2. AppLifecycleState lifecycleState
      )?,
    11. void didChangeLocales(
      1. BuildContext context,
      2. 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 with child parameter.
      • child : Widget to be used with builderWithChild. Used for optimization. builder or and only or builderWithChild with child 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 updated
      • afterInitialBuild : 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,
      InjectedBaseState<R> Function()? observe,
      Widget Function(BuildContext context, Injected<R>? rm)? builder,
      Widget Function(BuildContext context, Injected<R>? rm, Widget? child)?
          builderWithChild,
      Widget? child,
      void Function(BuildContext context, Injected<R>? rm)? initState,
      void Function(BuildContext context, Injected<R>? rm)? dispose,
      void Function(BuildContext context, Injected<R>? rm)? didChangeDependencies,
      void Function(
        BuildContext context,
        StateWithMixinBuilder<WidgetsBindingObserver, R> old,
      )?
          didUpdateWidget,
      void Function(BuildContext context, Injected<R>? rm)? afterInitialBuild,
      void Function(BuildContext context, Injected<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,
      );
    }