Skip to content

Commit

Permalink
fix: check state is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Oct 30, 2020
1 parent 0bdfb50 commit 611d59e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/src/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void _generateHeader(StringBuffer buffer, List<I18nData> allLocales) {
buffer.writeln('\tstatic Future<void> useDeviceLocale() async {');
buffer.writeln(
'\t\t$localeVar = await FastI18n.findDeviceLocale($mapVar.keys.toList(), $baseLocaleVar);');
buffer.writeln('\n\t\tif ($translationProviderKey != null)');
buffer.writeln('\n\t\tif ($translationProviderKey.currentState != null)');
buffer.writeln(
'\t\t\t$translationProviderKey.currentState.setLocale($localeVar);');
buffer.writeln('\t}');
Expand All @@ -126,7 +126,7 @@ void _generateHeader(StringBuffer buffer, List<I18nData> allLocales) {
buffer.writeln('\tstatic void setLocale(String locale) {');
buffer.writeln(
'\t\t$localeVar = FastI18n.selectLocale(locale, $mapVar.keys.toList(), $baseLocaleVar);');
buffer.writeln('\n\t\tif ($translationProviderKey != null)');
buffer.writeln('\n\t\tif ($translationProviderKey.currentState != null)');
buffer.writeln(
'\t\t\t$translationProviderKey.currentState.setLocale($localeVar);');
buffer.writeln('\t}');
Expand Down

0 comments on commit 611d59e

Please sign in to comment.