maybeOf static method

DrawerController? maybeOf(
  1. BuildContext context
)

The closest instance of DrawerController that encloses the given context, or null if none is found.

Typical usage is as follows:
link
DrawerController? controller = DrawerController.maybeOf(context);

Calling this method will create a dependency on the closest DrawerController in the context, if there is one.

See also:

Implementation

static DrawerController? maybeOf(BuildContext context) {
  return context.dependOnInheritedWidgetOfExactType<_DrawerControllerScope>()?.controller;
}