setLanguage method

Future<void> setLanguage(
  1. String language
)

Sets the language to the given value. While the language should be one in the supportedLanguages list, that is not actually a requirement. Setting the language to one that is not part of the supportedLanguages will result in the cached values being cleared and default strings being used until / unless the application applies the new translation values via the apply function.

Implementation

Future<void> setLanguage(String language) {
  _language = language;
  _translations.clear();
  _translationsStreamController?.add(null);
  return _load(_loaders[language]);
}