of static method

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

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

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

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

label: MercuryLocalizations.of(context).editMessageButtonLabel,

Implementation

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