Skip to content

Commit

Permalink
Check the initialCode in the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
lamnhan066 committed Aug 25, 2023
1 parent b19a284 commit d34a417
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/src/language_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -340,21 +340,21 @@ class LanguageHelper {
/// Change the language to this [code]
void change(LanguageCodes toCode) {
if (!codesBoth.contains(toCode)) {
printDebug('$toCode is not available in `data` or `dataOverrides');
printDebug('$toCode is not available in `data` or `dataOverrides`');

if (!_useInitialCodeWhenUnavailable) {
printDebug(
'Does not allow using the initial code => Cannot change the language.');
return;
} else {
if (_initialCode == null) {
printDebug(
'`useInitialCodeWhenUnavailable` is true but the `initialCode` is null => Cannot change the language');
return;
} else {
if (codesBoth.contains(_initialCode)) {
printDebug(
'`useInitialCodeWhenUnavailable` is true => Change the language to $_initialCode');
_currentCode = _initialCode;
} else {
printDebug(
'`useInitialCodeWhenUnavailable` is true but the `initialCode` is not available in `data` or `dataOverrides` => Cannot change the language');
return;
}
}
} else {
Expand Down

0 comments on commit d34a417

Please sign in to comment.