INNER CODE UNIT · Dart
of
BirjuVachhani/adaptive_theme · packages/adaptive_theme/lib/src/adaptive_theme.dart:77
static AdaptiveThemeManager<ThemeData> of(BuildContext context) {
context
.dependOnInheritedWidgetOfExactType<
InheritedAdaptiveTheme<ThemeData>
>()!;
return context.findAncestorStateOfType<State<AdaptiveTheme>>()!
as AdaptiveThemeManager<ThemeData>;
}
/// Returns reference of the [AdaptiveThemeManager] which allows access of
/// the state object of [AdaptiveTheme] in a restrictive way.
/// This returns null if the state instance of [AdaptiveTheme] is not found.
static AdaptiveThemeManager<ThemeData>? maybeOf(BuildContext context) {
context
.dependOnInheritedWidgetOfExactType<
InheritedAdaptiveTheme<ThemeData>
>();
final state = context.findAncestorStateOfType<State<AdaptiveTheme>>();