of static method

HatangChatLocalizations of(
  1. BuildContext context
)

The strings of the enclosing chat screen or view, else the nearest localizations, falling back to the ambient Locale (English if it starts with en, Vietnamese otherwise).

Implementation

// Static by design (mirrors MaterialLocalizations.of).
// ignore: prefer_constructors_over_static_methods
static HatangChatLocalizations of(BuildContext context) {
  final scope = HatangChatScope.maybeOf(context);
  if (scope != null) return HatangChatLocalizations(locale: scope.locale, strings: scope.strings);
  final found = maybeOf(context);
  if (found != null) return found;
  final l = Localizations.maybeLocaleOf(context);
  return HatangChatLocalizations.forLocale(fromFlutterLocale(l));
}