maybeOf static method

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

Typical usage is as follows:

DrivenSwitcherThemeData theme = DrivenSwitcherTheme.of(context);

Implementation

static DrivenSwitcherThemeData? maybeOf(BuildContext context) {
  final parentTheme =
      context.dependOnInheritedWidgetOfExactType<DrivenSwitcherTheme>();
  if (parentTheme != null) return parentTheme.data;

  final globalTheme = Theme.of(context).extension<DrivenSwitcherThemeData>();
  return globalTheme;
}