Creates a fixed-length list of the given length, and initializes the
value at each position with fill
:
new List<int>.filled(3, 0); // [0, 0, 0]
The length
must be a non-negative integer.
If the list is growable, changing its length will not initialize new
entries with fill
. After being created and filled, the list is
no different from any other growable or fixed-length list
created using List.
Source
external factory List.filled(int length, E fill, {bool growable: false});