The new lint in Dart 3.11
Dart 3.11 was released in February 2026, and the official announcement is here. However, it says nothing about a new linter rule this…
The new lint in Dart 3.11
Dart 3.11 was released in February 2026, and the official announcement is here. However, it says nothing about a new linter rule this version introduced.
simplify_variable_pattern
Patterns allow you to destructure an object:
void f(Object o) {
if (o case String(length: final len)) {
print('string is $len characters long');
}
}
This code checks of o is a String. If so, it takes its property length and puts it into a new local variable len.
There is a shorter style if you want to name the variable the same as the property you’re reading, you can just drop the property name:
void f(Object o) {
if (o case String(:final length)) {
print('string is $length characters long');
}
}
In between of them there is a redundant example:
void f(Object o) {
if (o case String(length: final length)) { // LINT: simplify_variable_pattern
print('string is $length characters long');
}
}
You don’t need to repeat the property name, and this new linter rule flags just that.
You may wonder why would anyone want to capture a variable like that to begin with. After all, this match promotes o to a String within the conditional body so you can just read it with o.length.
Indeed, destructuring is more often used with constants:
void f(Object o) {
if (o case String(length: 3)) {
print('string is three characters long');
}
}
However, there are advanced nested destructuring patterns like this:
if (o case User(address: Address(:final city))) {
print('The city is ${o.address.city}.'); // Only `o` is promoted.
print('The city is $city.'); // Fine.
}
The problem is that only o is promoted this way. If the address can be anything else, like if is nullable, then o.address is not promoted. And it’s not a compiler bug. The compiler doesn’t know if o.address is overridden with a getter and can return a different value every time. So it plays safe. But if we capture the city value like that then we are sure what it is.
That’s it for Dart 3.11. Enjoy the last days until 3.12 is out.
The Earlier Lints
If you have missed my articles on older lints, read them now:
- The 3 new lints in Dart 2.18.
- The 8 new lints in Dart 2.19.
- The 6 new lints in Dart 3.0.
- The 2 new lints in Dart 3.1.
- The new lint in Dart 3.2.
- There were no new lints in Dart 3.3.
- The 2 new lints in Dart 3.4.
- The 3 new lints in Dart 3.5.
- The 4 new lints in Dart 3.6.
- The 7 new lints in Dart 3.7.
- The new lint in Dart 3.8.
- The 2 new lints in Dart 3.9.
- The new lint in Dart 3.10.
Enabling the New Lint
Read this article on how to enable this new lint manually.
Alternatively, you can use my package total_lints which enables most of the lints for your project. I use it to avoid repeating the linter configuration for my projects.
Never miss a story, follow my Telegram channel: ainkin_com

메타데이터
- post_id
- 18a2a98673d8
- slug
- the-new-lint-in-dart-3-11-18a2a98673d8
- url
- https://medium.com/@alexey.inkin/the-new-lint-in-dart-3-11-18a2a98673d8
- canonical_url
- https://medium.com/@alexey.inkin/the-new-lint-in-dart-3-11-18a2a98673d8
- author_url
- https://medium.com/@alexey.inkin
- status
- ok
- fetched_at
- 2026-06-09 15:37:30