get method

dynamic get(
  1. dynamic text, {
  2. Map vars = const {},
})

Implementation

get(text, {Map vars = const {}}) {
  String hash = md5.convert(utf8.encode(text)).toString();

  if (globalTranslations[hash] == null) {
    // obtain translation
    fetchSingleTranslation(text, _targetLocale).then((res) {
      if (totalPendingRequests == 0) {
        instance.setState(() {});
      }
    });
  }

  return globalTranslations[hash] ?? text;
}