StateBuilder<T> constructor

const StateBuilder<T>({
  1. Key? key,
  2. Widget builder(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  3. ReactiveModel<T> observe()?,
  4. List<ReactiveModel Function()>? observeMany,
  5. Widget builderWithChild(
    1. BuildContext context,
    2. ReactiveModel<T>? model,
    3. Widget child
    )?,
  6. Widget? child,
  7. dynamic onSetState(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  8. void onRebuildState(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  9. Object? watch(
    1. SnapState<T>? model
    )?,
  10. bool shouldRebuild(
    1. SnapState<T>? model
    )?,
  11. void initState(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  12. void dispose(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  13. void didChangeDependencies(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
  14. void didUpdateWidget(
    1. BuildContext context,
    2. ReactiveModel<T>? model,
    3. StateBuilder<T> oldWidget
    )?,
  15. void afterInitialBuild(
    1. BuildContext context,
    2. ReactiveModel<T>? model
    )?,
})

One of the three observer widgets in states_rebuilder

See: WhenRebuilder, WhenRebuilderOr

Implementation

const StateBuilder({
  Key? key,
  // For state management
  this.builder,
  this.observe,
  this.observeMany,
  // this.tag,
  this.builderWithChild,
  this.child,
  this.onSetState,
  this.onRebuildState,
  this.watch,
  this.shouldRebuild,

  // For state lifecycle
  this.initState,
  this.dispose,
  this.didChangeDependencies,
  this.didUpdateWidget,
  this.afterInitialBuild,
})  : assert(builder != null || builderWithChild != null, '''

| ***Builder not defined***
| You have to define either 'builder' or 'builderWithChild' parameter.
| Use 'builderWithChild' with 'child' parameter.
| If 'child' is null use 'builder' instead.

      '''),
      assert(builderWithChild == null || child != null, '''
| ***child is null***
| You have defined the 'builderWithChild' parameter without defining the child parameter.
| Use 'builderWithChild' with 'child' parameter.
| If 'child' is null use 'builder' instead.

      '''),
      super(key: key);