Hint when type of element in list literal does not match variable type in assignment statement #20297
Labels
analyzer-warning
Issues with the analyzer's Warning codes
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
There is no warning here ...
List<String> list = [ new SomeClass() ];
... but when I refactor it, the warning appears ...
List<String> list = [];
list.add(new SomeClass()); // <<< warning argument type 'SomeClass' not assignable to 'String'
It would be helpful if there was at least a hint in the former case so that I catch problem code earlier.
The text was updated successfully, but these errors were encountered: