of static method Null safety

CupertinoThemeData of(
  1. BuildContext context
)

Retrieves the CupertinoThemeData from the closest ancestor CupertinoTheme widget, or a default CupertinoThemeData if no CupertinoTheme ancestor exists.

Resolves all the colors defined in that CupertinoThemeData against the given BuildContext on a best-effort basis.

Implementation

static CupertinoThemeData of(BuildContext context) {
  final _InheritedCupertinoTheme? inheritedTheme = context.dependOnInheritedWidgetOfExactType<_InheritedCupertinoTheme>();
  return (inheritedTheme?.theme.data ?? const CupertinoThemeData()).resolveFrom(context);
}