of method Null safety

NavigationRailThemeData of(
  1. BuildContext context
)

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

If there is no enclosing NavigationRailTheme widget, then ThemeData.navigationRailTheme is used.

Typical usage is as follows:

NavigationRailThemeData theme = NavigationRailTheme.of(context);

Implementation

static NavigationRailThemeData of(BuildContext context) {
  final NavigationRailTheme? navigationRailTheme = context.dependOnInheritedWidgetOfExactType<NavigationRailTheme>();
  return navigationRailTheme?.data ?? Theme.of(context).navigationRailTheme;
}