of static method

Retrieves the IconButtonThemeData from the closest ancestor IconButtonTheme.

If there is no enclosing IconButtonTheme widget, then ThemeData.iconButtonTheme is used.

The returned IconButtonThemeData.variant is the value specified by that theme, which can be null even when an ancestor specifies a variant. Use variantOf to get the variant that applies at the given context.

Typical usage is as follows:

IconButtonThemeData theme = IconButtonTheme.of(context);

Implementation

static IconButtonThemeData of(BuildContext context) {
  final IconButtonTheme? buttonTheme = context
      .dependOnInheritedWidgetOfExactType<IconButtonTheme>();
  return buttonTheme?.data ?? Theme.of(context).iconButtonTheme;
}