of static method

_I18nState of(
  1. BuildContext context
)

Getter: print(I18n.of(context).locale);

Setter: I18n.of(context).locale = Locale("en", "US");

Implementation

static _I18nState of(BuildContext context) {
  _InheritedI18n? inherited = context.dependOnInheritedWidgetOfExactType<_InheritedI18n>();

  if (inherited == null)
    throw TranslationsException("Can't find the `I18n` widget up in the tree. "
        "Please make sure to wrap some ancestor widget with `I18n`.");

  return inherited.data;
}