[BUG] check-unused-l10n doesn't find methods called via getter #570
Comments
Same issue with extensions: extension L10nExtensions on BuildContext {
MyLocalization get l10n => MyLocalization.of(this);
} If we call : final myTitle = context.l10n.title; That's not considered as used i10n. |
@diegoveloper that looks harder, could you share, where |
Actually, sorry, I was wrong, we don't need this info to calculate usages correctly. |
I'll take a closer look a bit later. |
Available in 4.9.0 release 🚀 |
Thanks, guys, I've found that it doesn't work for functions.
|
@furaiev could you share the code example for the case it's not working as expected? |
|
@furaiev thank you, I'll try to reproduce it today and add a fix. |
@incendial thank you, could you please also reopen #524 |
@furaiev are you sure it's not just this problem? From what I see it's because of |
There are broken getters (w/o arguments) via current, e.g. Summary: |
@furaiev interesting, but tests don't trigger on that. Could you share |
Got it, working on a fix. |
Available in 4.9.1 release 🚀 |
I just updated it to version 4.9.1 and I still get the same issue, and probably my way of calling the getter is different. This is how get the localized text:
For this case, the command recognised it as unused too. |
@dkrutskikh @incendial thank you for a fix, all is works for me. Could you please exclude private members of the Localization class? (this is not critical at all, just nice to have)
@winsonloh1998 the example that you have provided is another issue/feature(?). I'm not sure if it is easy to manage and track Localization reassignments. But let's wait for @dkrutskikh @incendial answer. |
@winsonloh1998 @furaiev could you create separate issues for you feature requests? Both of them look valid and nice to have, but they are out of this issue scope. |
Please show your full configuration:
Configuration
What did you do? Please include the source code example causing the issue.
Code details
What did you expect to happen?
the command consider
S.current.title
as used l10nWhat actually happened?
the command doesn't consider
S.current.title
as used l10nThe text was updated successfully, but these errors were encountered: