maybeOf method Null safety

SliverReorderableListState? maybeOf(
  1. BuildContext context
)

The state from the closest instance of this class that encloses the given context.

This method is typically used by SliverReorderableList item widgets that insert or remove items in response to user input.

If no SliverReorderableList surrounds the context given, this function will return null.

This method can be expensive (it walks the element tree).

See also:

Implementation

static SliverReorderableListState? maybeOf(BuildContext context) {
  assert(context != null);
  return context.findAncestorStateOfType<SliverReorderableListState>();
}