maybeOf static method
- BuildContext context
Finds the TreeSliver from the closest instance of this class that encloses the given context and returns its TreeSliverController.
If no TreeSliver encloses the given context then return null. To throw an exception instead, use of instead of this function.
See also:
- of, a similar function to this one that throws if no TreeSliver encloses the given context. Also includes some sample code in its documentation.
Implementation
static TreeSliverController? maybeOf(BuildContext context) {
return context.findAncestorStateOfType<_TreeSliverState<Object?>>()?.controller;
}