maybeOf static method
- BuildContext context
The closest instance of DrawerController that encloses the given context, or null if none is found.
Calling this method will create a dependency on the closest
DrawerController in the context
, if there is one.
See also:
- DrawerController.of, which is similar to this method, but asserts if no DrawerController ancestor is found.
Implementation
static DrawerController? maybeOf(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<_DrawerControllerScope>()?.controller;
}