of method Null safety

ButtonBarThemeData of(
  1. BuildContext context
)

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

Typical usage is as follows:

ButtonBarThemeData theme = ButtonBarTheme.of(context);

Implementation

static ButtonBarThemeData of(BuildContext context) {
  final ButtonBarTheme? buttonBarTheme = context.dependOnInheritedWidgetOfExactType<ButtonBarTheme>();
  return buttonBarTheme?.data ?? Theme.of(context).buttonBarTheme;
}