Skip to main content

avoid-missing-tr-on-strings

effort: 2m
has IDE fix
teams+

Warns when the tr extension method is not called on string literals.

Example

❌ Bad:

void fn() {
// LINT: Missing 'tr' invocation on this string literal.
Text('str');

// LINT: Missing 'tr' invocation on this string literal.
Text(key: 1, 'str');
}

✅ Good:

void fn() {
Text('str'.tr());
Text('str').tr();
Text(key: 1, 'str'.tr());
}