Migration: better handling of list constructor invocations #44198
Labels
area-migration (deprecated)
Deprecated: this label is no longer actively used (was: issues with the `dart migrate` tool).
NNBD
Issues related to NNBD Release
P2
A bug or feature request we're likely to work on
Currently when the migration tool encounters a list constructor invocation, it leaves it alone,
because it doesn't know how to migrate it without help from the user. This leads to a bad user experience because the user sees compilation errors and doesn't know why.It would be a lot nicer if the migration tool could add a TODO comment along with a link to some documentation of how list constructors should be migrated.Edit: as @lrhn points out below, there actually is a reasonable thing the migration tool can do:
List()
to[]
List<T>()
to<T>[]
List(n)
toList.filled(n, null)
List<T>(n)
toList<T?>.filled(n, null)
Of course the migrations with
List.filled
result in the list element type being nullable, but that's the sort of thing they'll be fixing anyway as part of the migration process.The text was updated successfully, but these errors were encountered: