Lists in Dart

What is List?

The List is to create an integer indexed collection of objects, that each objects are identified or accessed by index.

An List or Array is a data structure consisting of a collection of elements like values or variables.

Array is a collection of objects. In Dart, arrays are List objects.

A list may contain zero or more objects.

A non-empty list has first element at 0 index and last element at list.length-1 index

You can create and initialize lists in multiple ways:

  1. List literal.
  2. List constructor
  3. Parameterized type List literal.
  4. Parameterized type List constructor.

The List class also defines several methods for manipulating list values or variables, like, add, remove and sort etc.

Note: Learn more about Lists in Learn Dart Collections Course.