Tsallaka zuwa abun ciki
Justice Tech School

Dart Lists

A List is an ordered, growable collection. Members: add, remove, contains, length, first, last, sort, indexOf. The spread operator ... and collection if and for build lists.

Example
void main() {
  var fruits = ["apple", "banana"];
  fruits.add("cherry");
  print(fruits.length);
  print([...fruits, "date"]);
  print([for (var i = 1; i <= 3; i++) i * i]);
}

Exercise

Add an item.

list.("x")

Quiz Test

Which adds to a list?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.