Open
Description
Dart SDK version: 3.9.0-252.0.dev (dev) (Thu Jun 19 05:08:58 2025 -0700) on "macos_x64"
Analyzer via VSCode with lint rule prefer_const_constructors
enabled
class A
{ A():
cannotBeConst=0;
int cannotBeConst;
}
extension type const B(A a)
{}
B get b=>
.new(A()); // Nonexpected error `prefer_const_constructors` :(
The lint rule prefer_const_constructors
should not be triggered here because const
cannot be used in this case. This is only an issue when the dot shorthand .new
is used
B get b=>
B(A()); // no dot-shorthand, no error :)