of method Null safety

NavigationBarThemeData of(
  1. BuildContext context
)

The closest instance of this class that encloses the given context.

If there is no enclosing NavigationBarTheme widget, then ThemeData.navigationBarTheme is used.

Typical usage is as follows:

NavigationBarThemeData theme = NavigationBarTheme.of(context);

Implementation

static NavigationBarThemeData of(BuildContext context) {
  final NavigationBarTheme? navigationBarTheme = context.dependOnInheritedWidgetOfExactType<NavigationBarTheme>();
  return navigationBarTheme?.data ?? Theme.of(context).navigationBarTheme;
}