Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

This constructor cannot be used in null-safe code. Use [List.filled] to create a non-empty list.

### Declare

var foo = List<int>();  // Now error
var bar = List<int>(n); // Now error
var baz = List<int>(0); // Now error


##### Use these
var foo = <int>[];           // Always the recommended way.
var bar = List.filled(1, 0); // Not filled with `null`s.
var baz = List<int>.empty();
 
PREVIOUS NEXT
Tagged: #This #constructor #Use #create
ADD COMMENT
Topic
Name
5+4 =