CellWidget.builder constructor

CellWidget.builder(
  1. Widget builder(
    1. BuildContext context
    ), {
  2. Key? key,
  3. 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.

Cells defined directly within builder will have their state restored between builds. The same rules must be observed when defining cells in builder that must be observed when defining cells in the build method of a CellWidget subclass.

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(BuildContext context) builder, {
  Key? key,
  String? restorationId
}) => _CellWidgetBuilder(builder,
  key: key,
  restorationId: restorationId,
);