List

In Dart, arrays are List objects, so most people just call them lists.

var list = [1, 2, 3];
  • Perhaps the most common collection in nearly every programming language is the array, or ordered group of objects.
  • Lists use zero-based indexing, where 0 is the index of the first element and list.length - 1 is the index of the last element.
  • To create a list that’s a compile-time constant, add const before the list literal.
  • You can use the spread operator (...) to insert all the elements of a list into another list.
  • If the expression to the right of the spread operator might be null, you can avoid exceptions by using a null-aware spread operator (...?).
  • You can use collection if to create a list with three or four items in it.
  • Using collection for to manipulate the items of a list before adding them to another list.

List — Structure map

Clickable & Draggable!

List — Related pages: