There are a few ways to create an empty list in Dart. If you want a growable list then use an empty list literal like this:
[]
Or this if you need to specify the type:
<String>[]
Or this if you want a non-growable (fixed-length) list:
List.empty()
Notes
- In the past you could use
List()but this is now deprecated. The reason is thatList()did not initialize any members, and that isn’t compatible with null safe code. Read Understanding null safety: No unnamed List constructor for more. - Effective Dart Usage Guide