StaticWidget.builder constructor
StaticWidget.builder(
- WidgetBuilder builder, {
- Key? key,
- String? restorationId,
Create a StaticWidget with the build method defined by builder
.
This allows a StaticWidget to be created without subclassing.
If restorationId
is non-null ValueCell.restore
may be called immediately
within builder
to restore the state of cells.
Example:
StaticWidget.builder((context) {
final count = MutableCell(0);
final strCount = ValueCell.computed(() => count().toString());
return ElevatedButton(
child: CellText(data: strCount),
onPressed: () => count++
);
});
Implementation
factory StaticWidget.builder(WidgetBuilder builder, {
Key? key,
String? restorationId
}) => _StaticWidgetBuilder(
key: key,
restorationId: restorationId,
builder: builder
);