Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Small fix on Translations.get #564

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/translations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Translations {

/// If we failed to find the key as a nested key, then fall back
/// to looking it up like normal.
returnValue ??= _translations?[key];
var maybeValue = _translations?[key];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we do the lookup all the time, even if it's not needed because returnValue != null

if (maybeValue is String) returnValue ??= maybeValue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a unittest for the new behavior


return returnValue;
}
Expand Down