Adding, Removing, and Updating Items
Mutate a list safely.
Lists Can Change
Most Dart lists are growable, meaning you can add and remove items after creating them. That makes them perfect for data that changes over time.
Add to the End
The add method appends one item to the back of the list. The list grows by one and the new item takes the last index.
var todos = ['wake up'];
todos.add('code');All lessons in this course
- Creating Lists and Indexing
- Adding, Removing, and Updating Items
- Searching and Sorting Lists
- Transforming With map, where, and toList