of static method

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

Typical usage is as follows:

AlertThemeData theme = AlertTheme.of(context);

Implementation

static AlertThemeData of(BuildContext context) {
  final parentTheme =
      context.dependOnInheritedWidgetOfExactType<AlertTheme>();
  if (parentTheme != null) return parentTheme.data;

  final globalTheme = Theme.of(context).extension<AlertThemeData>();
  final defaultTheme = AlertThemeData.defaults(context);
  return defaultTheme.merge(globalTheme);
}