of method Null safety

ExpansionTileThemeData of(
  1. BuildContext context
)

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

If there is no enclosing ExpansionTileTheme widget, then ThemeData.expansionTileTheme is used.

Typical usage is as follows:

ExpansionTileThemeData theme = ExpansionTileTheme.of(context);

Implementation

static ExpansionTileThemeData of(BuildContext context) {
  final ExpansionTileTheme? inheritedTheme = context.dependOnInheritedWidgetOfExactType<ExpansionTileTheme>();
  return inheritedTheme?.data ?? Theme.of(context).expansionTileTheme;
}