Open
Description
Dart SDK version: 3.9.0-235.0.dev (dev) (Fri Jun 13 21:03:03 2025 -0700) on "macos_x64"
Consider
class T
{ const T();
}
void f([T t=T()]) // ERROR: non_constant_default_value
{}
non_constant_default_value
is reported as expected and can be resolved by changing [T t=T()]
to [T t=const T()]
. But if the experimental dot shorthand syntax is used to invoke the same constructor without the const
keyword, no error is reported by the static analyzer via VSCode
void f([T t=.new()]) // no error :(
{}
The error is only reported when trying to run the code