of static method

PopupMenuThemeData of(
  1. BuildContext context
)

The closest instance of this class's data value that encloses the given context. If there is no ancestor, it returns ThemeData.popupMenuTheme. Applications can assume that the returned value will not be null.

Typical usage is as follows:

PopupMenuThemeData theme = PopupMenuTheme.of(context);

Implementation

static PopupMenuThemeData of(BuildContext context) {
  final PopupMenuTheme? popupMenuTheme = context.dependOnInheritedWidgetOfExactType<PopupMenuTheme>();
  return popupMenuTheme?.data ?? Theme.of(context).popupMenuTheme;
}