CellWidget.builder constructor
CellWidget.builder(
- Widget builder(
- CellHookContext context
- Key? key,
- String? restorationId,
Create a CellWidget with the build method defined by builder
.
This allows a widget, which is dependent on the values of one or more cells, to be defined without subclassing.
builder
is provided a CellHookContext, instead of a BuildContext,
which allows cells to be defined within the builder using CellHookContext.cell,
and watch functions to be defined using CellHookContext.watch.
If restorationId
is non-null it is used as the restoration ID for
restoring the state of the cells created within builder
.
Example:
WidgetCell.builder((context) => Text('The value of cell a is ${a()}'))
Implementation
factory CellWidget.builder(Widget Function(CellHookContext context) builder, {
Key? key,
String? restorationId
}) => _WidgetCellBuilder(builder,
key: key,
restorationId: restorationId,
);