of static method

M3EThemeData of(
  1. BuildContext context
)

Returns the nearest expressive theme, or derives one from Material.

Implementation

static M3EThemeData of(BuildContext context) {
  final M3EInheritedTheme? inherited = context
      .dependOnInheritedWidgetOfExactType<M3EInheritedTheme>();
  if (inherited != null) {
    return inherited.data;
  }
  M3EThemeScope.resolveForComponent(context);
  final M3EThemeData? scoped = M3EThemeScope.resolveOf(context);
  if (scoped != null) {
    return scoped;
  }
  return M3EThemeData.fromMaterial(Theme.of(context));
}