Skip to main content

avoid-missing-tr

added in: 1.21.0
🛠
Pro+

Warns when the tr extension method is not called on localization keys.

Example

❌ Bad:

void fn() {
// LINT: Missing 'tr' invocation on this localization key.
print(LocaleKeys.title);

// LINT: Missing 'tr' invocation on this localization key.
Text(LocaleKeys.title);
}

✅ Good:

void fn() {
print(LocaleKeys.title.tr());
print(LocaleKeys.title.plural());

Text(LocaleKeys.title).tr();
Text(LocaleKeys.title).plural();

Custom(LocaleKeys.title.tr());
Custom(LocaleKeys.title).tr();
}