maybeOf static method
- BuildContext context
Returns the MenuController of the ancestor RawMenuAnchor nearest to
the given context
, if one exists. Otherwise, returns null.
This method will not establish a dependency relationship, so the calling widget will not rebuild when the menu opens and closes, nor when the MenuController changes.
Implementation
static MenuController? maybeOf(BuildContext context) {
return context.getInheritedWidgetOfExactType<_MenuControllerScope>()?.controller;
}