A list is an ordered collection of items. In Dart, lists are used to store multiple values in a single variable. Lists can be of fixed or variable length, and they support a variety of methods and properties for manipulating the elements.

void main() { // Creating a fixed-length list var fixedList = List<int>.filled(5, 0); // List of 5 integers, all initialized to 0 print(fixedList); // Output: [0, 0, 0, 0, 0]

// Creating a growable list var growableList = <String>['Alice', 'Bob', 'Charlie']; print(growableList); // Output: [Alice, Bob, Charlie]

// Adding elements to a growable list growableList.add('Diana'); print(growableList); // Output: [Alice, Bob, Charlie, Diana]

// Accessing list elements print(growableList[1]); // Output: Bob

// Changing list elements growableList[1] = 'Bill'; print(growableList); // Output: [Alice, Bill, Charlie, Diana]

// Removing elements from a growable list growableList.remove('Charlie'); print(growableList); // Output: [Alice, Bill, Diana]

// Iterating over a list for (var name in growableList) { print(name); } // Output: // Alice // Bill // Diana

// List properties and methods print(growableList.length); // Output: 3 print(growableList.isEmpty); // Output: false print(growableList.contains('Alice')); // Output: true

// Combining lists var moreNames = ['Eve', 'Frank']; var allNames = growableList + moreNames; print(allNames); // Output: [Alice, Bill, Diana, Eve, Frank] }