maybeOf method Null safety
- BuildContext context
The state from the closest instance of this class that encloses the given context.
This method is typically used by SliverAnimatedList item widgets that insert or remove items in response to user input.
If no SliverAnimatedList surrounds the context given, then this function will return null.
This method can be expensive (it walks the element tree).
See also:
- of, a similar function that will throw if no SliverAnimatedList ancestor is found.
Implementation
static SliverAnimatedListState? maybeOf(BuildContext context) {
assert(context != null);
return context.findAncestorStateOfType<SliverAnimatedListState>();
}