of static method

CardThemeData of(
  1. BuildContext context
)

Returns the configuration data from the closest CardTheme ancestor.

If there is no ancestor, it returns ThemeData.cardTheme.

Typical usage is as follows:

CardThemeData theme = CardTheme.of(context);

Implementation

static CardThemeData of(BuildContext context) {
  final CardTheme? cardTheme = context.dependOnInheritedWidgetOfExactType<CardTheme>();
  return cardTheme?.data ?? Theme.of(context).cardTheme;
}