ofType<T extends FlutterFireUIStyle> static method

T ofType<T extends FlutterFireUIStyle>(
  1. BuildContext context,
  2. T defaultValue
)

Implementation

static T ofType<T extends FlutterFireUIStyle>(
  BuildContext context,
  T defaultValue,
) {
  final el =
      context.getElementForInheritedWidgetOfExactType<FlutterFireUITheme>();
  if (el == null) return defaultValue;

  context.dependOnInheritedElement(el, aspect: T);
  final style = (el as FlutterFireUIThemeElement).styles[T];

  if (style == null) return defaultValue;
  return style as T;
}