watch method
Widget
watch({
- required Widget builder(
- BuildContext context,
- SectionView<
K, Section, Item> view
- Key? widgetKey,
Selectively rebuilds builder when this section's state changes:
- expand/collapse
- section payload (via
controller.updateSection) - item count (items added or removed under this section)
The most common reason to use watch in a header is to keep a "X items" badge in sync as items churn under the section.
Implementation
Widget watch({
required Widget Function(
BuildContext context,
SectionView<K, Section, Item> view,
)
builder,
Key? widgetKey,
}) {
return _SectionViewListener<K, Section, Item>(
key: widgetKey,
controller: controller,
sectionKey: key,
isCollapsible: isCollapsible,
builder: builder,
);
}