of static method

CupertinoLocalizations of(
  1. BuildContext context
)

The CupertinoLocalizations from the closest Localizations instance that encloses the given context.

If no CupertinoLocalizations are available in the given context, this method throws an exception.

This method is just a convenient shorthand for: Localizations.of<CupertinoLocalizations>(context, CupertinoLocalizations)!.

References to the localized resources defined by this class are typically written in terms of this method. For example:

CupertinoLocalizations.of(context).anteMeridiemAbbreviation;

Implementation

static CupertinoLocalizations of(BuildContext context) {
  assert(debugCheckHasCupertinoLocalizations(context));
  return Localizations.of<CupertinoLocalizations>(context, CupertinoLocalizations)!;
}