of static method Null safety

BottomNavigationBarThemeData of(
  1. BuildContext context

Returns the configuration data from the closest BottomNavigationBarTheme ancestor. If there is no ancestor, it returns ThemeData.bottomNavigationBarTheme. Applications can assume that the returned value will not be null.

Typical usage is as follows:

BottomNavigationBarThemeData theme = BottomNavigationBarTheme.of(context);


static BottomNavigationBarThemeData of(BuildContext context) {
  final BottomNavigationBarTheme? bottomNavTheme = context.dependOnInheritedWidgetOfExactType<BottomNavigationBarTheme>();
  return bottomNavTheme?.data ?? Theme.of(context).bottomNavigationBarTheme;