populateLanguages method

void populateLanguages()

Populate maps for languages at startup to optimise performance.

Implementation

void populateLanguages() async {
  /// A list of languages that the app will support at runtime.
  final List<Language> availableLanguages = List<Language>.unmodifiable(
    [
      JapaneseLanguage.instance,
      EnglishLanguage.instance,
    ],
  );

  languages = Map<String, Language>.unmodifiable(
    Map<String, Language>.fromEntries(
      availableLanguages.map(
        (language) => MapEntry(language.locale.toLanguageTag(), language),
      ),
    ),
  );
}