of static method

The data from the closest instance of this class that encloses the given context, if any.

If there is no ambient icon theme, defaults to MacosIconThemeData.fallback. The returned MacosIconThemeData is concrete (all values are non-null; see MacosIconThemeData.isConcrete). Any properties on the ambient icon theme that are null get defaulted to the values specified on MacosIconThemeData.fallback.

The MacosTheme widget from the macos_ui library introduces a MacosIconTheme widget set to the MacosThemeData.iconTheme, so in a macos_ui-style application, this will typically default to the icon theme from the ambient MacosTheme.

Typical usage is as follows:

MacosIconThemeData theme = MacosIconTheme.of(context);

Implementation

static MacosIconThemeData of(BuildContext context) {
  final MacosIconThemeData iconThemeData =
      _getInheritedIconThemeData(context).resolve(context);
  return iconThemeData.isConcrete
      ? iconThemeData
      : iconThemeData.copyWith(
          size:
              iconThemeData.size ?? const MacosIconThemeData.fallback().size,
          color: iconThemeData.color ??
              const MacosIconThemeData.fallback().color,
          opacity: iconThemeData.opacity ??
              const MacosIconThemeData.fallback().opacity,
        );
}