ZenBuilder<T extends ZenController> constructor

const ZenBuilder<T extends ZenController>({
  1. required Widget builder(
    1. BuildContext context,
    2. T controller
    ),
  2. String? tag,
  3. String? id,
  4. ZenScope? scope,
  5. T create()?,
  6. void init(
    1. T controller
    )?,
  7. bool disposeOnRemove = false,
  8. Widget onError(
    1. Object error
    )?,
  9. Key? key,
})

Creates a widget that rebuilds when the controller updates.

The builder function is called with the current BuildContext and controller instance. The tag parameter can be used to identify specific controller instances. The id parameter can be used to listen to specific update events. The scope parameter explicitly defines which scope to use for controller lookup. The create parameter provides a factory function for controller creation if not found. The init parameter allows initialization of newly created controllers. The disposeOnRemove parameter controls whether locally created controllers should be disposed.

Implementation

const ZenBuilder({
  required this.builder,
  this.tag,
  this.id,
  this.scope,
  this.create,
  this.init,
  this.disposeOnRemove = false,
  this.onError,
  super.key,
}) : assert(disposeOnRemove == false || create != null,
          'disposeOnRemove requires create function');