of method Null safety

ToggleButtonsThemeData of(
  1. BuildContext context
)

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

If there is no enclosing ToggleButtonsTheme widget, then ThemeData.toggleButtonsTheme is used.

Typical usage is as follows:

ToggleButtonsTheme theme = ToggleButtonsTheme.of(context);

Implementation

static ToggleButtonsThemeData of(BuildContext context) {
  final ToggleButtonsTheme? toggleButtonsTheme = context.dependOnInheritedWidgetOfExactType<ToggleButtonsTheme>();
  return toggleButtonsTheme?.data ?? Theme.of(context).toggleButtonsTheme;
}