setLocale method

Future<void> setLocale({
  1. required Locale locale,
})

changes locale

Implementation

Future<void> setLocale({
  required Locale locale,
}) async {
  _locale = locale;

  String filePath = "$_assetsDir${_locale!.languageCode}.json";
  String content = await rootBundle.loadString(filePath);

  _values = json.decode(content);
}