of static method
- BuildContext context
Returns the configuration data from the closest SwitchTheme ancestor. If there is no ancestor, it returns ThemeData.switchTheme.
Typical usage is as follows:
SwitchThemeData theme = SwitchTheme.of(context);
Implementation
static SwitchThemeData of(BuildContext context) {
final SwitchTheme? switchTheme = context.dependOnInheritedWidgetOfExactType<SwitchTheme>();
return switchTheme?.data ?? Theme.of(context).switchTheme;
}