of static method
Gets the ThemeData from the closest Theme ancestor.
Throws if no Theme is found in the widget tree.
Returns: ThemeData — the theme data.
Implementation
static ThemeData of(BuildContext context) {
final theme = context.dependOnInheritedWidgetOfExactType<Theme>();
assert(theme != null, 'No Theme found in context');
return theme!.data;
}