of method

IconThemeData of (
  1. BuildContext context
)

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

Defaults to the current ThemeData.iconTheme.

Typical usage is as follows:

IconThemeData theme = IconTheme.of(context);

Implementation

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