of<T extends ComponentThemeData> static method

T of<T extends ComponentThemeData>(
  1. BuildContext context
)

Gets the component theme data of type T from the closest ancestor.

Throws if no ComponentTheme of type T is found.

Returns: T — the component theme data.

Implementation

static T of<T extends ComponentThemeData>(BuildContext context) {
  final data = maybeOf<T>(context);
  assert(data != null, 'No ComponentTheme<$T> found in context');
  return data!;
}