setLanguage method
changes active language
Implementation
Future<void> setLanguage(
BuildContext context, {
required String language,
bool restart = true,
}) async {
if (language == "") {
language = _locale?.languageCode ?? _langList[0];
}
_locale = Locale(language, "");
String filePath = "$_assetsDir$language.json";
String content = await rootBundle.loadString(filePath);
_values = json.decode(content);
if (restart) {
LocalizedApp.restart(context);
}
}