hasMapping method

bool hasMapping(
  1. String? locale,
  2. String? textId
)

Whether locale's own sources map textId (no fallbacks). Throws UnregisteredLocaleException if locale isn't defined.

Implementation

bool hasMapping(String? locale, String? textId) {
  if (locale == null || !_locales.contains(locale)) {
    throw UnregisteredLocaleException(
      'Attempted to access an undefined locale ($locale) while checking for '
      'a mapping for  $textId',
    );
  }
  return _localeResources[locale]!.any(
    (source) => source.localizedText.containsKey(textId),
  );
}