@@ -88,7 +88,8 @@ class EasyLocalizationController extends ChangeNotifier {
8888 if (useFallbackTranslations && _fallbackLocale != null ) {
8989 Map <String , dynamic >? baseLangData;
9090 if (_locale.countryCode != null && _locale.countryCode! .isNotEmpty) {
91- baseLangData = await loadBaseLangTranslationData (Locale (locale.languageCode));
91+ baseLangData =
92+ await loadBaseLangTranslationData (Locale (locale.languageCode));
9293 }
9394 data = await loadTranslationData (_fallbackLocale! );
9495 if (baseLangData != null ) {
@@ -103,7 +104,8 @@ class EasyLocalizationController extends ChangeNotifier {
103104 }
104105 }
105106
106- Future <Map <String , dynamic >?> loadBaseLangTranslationData (Locale locale) async {
107+ Future <Map <String , dynamic >?> loadBaseLangTranslationData (
108+ Locale locale) async {
107109 try {
108110 return await loadTranslationData (Locale (locale.languageCode));
109111 } on FlutterError catch (e) {
@@ -133,24 +135,24 @@ class EasyLocalizationController extends ChangeNotifier {
133135
134136 Future <void > _saveLocale (Locale ? locale) async {
135137 if (! saveLocale) return ;
136- final _preferences = await SharedPreferences .getInstance ();
137- await _preferences .setString ('locale' , locale.toString ());
138+ final preferences = await SharedPreferences .getInstance ();
139+ await preferences .setString ('locale' , locale.toString ());
138140 EasyLocalization .logger ('Locale $locale saved' );
139141 }
140142
141143 static Future <void > initEasyLocation () async {
142- final _preferences = await SharedPreferences .getInstance ();
143- final _strLocale = _preferences .getString ('locale' );
144- _savedLocale = _strLocale != null ? _strLocale .toLocale () : null ;
145- final _foundPlatformLocale = await findSystemLocale ();
146- _deviceLocale = _foundPlatformLocale .toLocale ();
144+ final preferences = await SharedPreferences .getInstance ();
145+ final strLocale = preferences .getString ('locale' );
146+ _savedLocale = strLocale ? .toLocale ();
147+ final foundPlatformLocale = await findSystemLocale ();
148+ _deviceLocale = foundPlatformLocale .toLocale ();
147149 EasyLocalization .logger.debug ('Localization initialized' );
148150 }
149151
150152 Future <void > deleteSaveLocale () async {
151153 _savedLocale = null ;
152- final _preferences = await SharedPreferences .getInstance ();
153- await _preferences .remove ('locale' );
154+ final preferences = await SharedPreferences .getInstance ();
155+ await preferences .remove ('locale' );
154156 EasyLocalization .logger ('Saved locale deleted' );
155157 }
156158
0 commit comments