of static method

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

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

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

CountryLocalizations.of(context).countryName(countryCode: country.countryCode),

Implementation

static CountryLocalizations? of(BuildContext context) {
  return Localizations.of<CountryLocalizations>(
    context,
    CountryLocalizations,
  );
}