Skip to main content

avoid-non-ascii-symbols

added in: 1.6.0
⚙️

Warns when a string literal contains non ascii characters. This might indicate that the string was not localized.

⚙️ Config

Set ignored-invocations (default is [print, debugPrint]) to ignore strings inside a specific invocation.

dart_code_metrics:
...
rules:
...
- avoid-non-ascii-symbols:
ignored-invocations:
- print
- debugPrint

Example

❌ Bad:

final chinese = 'hello 汉字'; // LINT
final russian = 'hello привет'; // LINT
final withSomeNonAsciiSymbols = '#!$_&- éè ;∞¥₤€'; // LINT
final misspelling = 'inform@tiv€'; // LINT

✅ Good:

final english = 'hello';
final someGenericSymbols ='!@#$%^';