Collections
In Dart, lists are considered to be the same as arrays in other programming languages with some handy methods to manipulate elements.
Lists have the [index] operator to access elements at the given index and, additionally, the + operator can be used to concatenate two lists by returning a new list with the left operand followed by the right one.
Another important thing about Dart lists is the length constraint. This is in the way we define the preceding lists, making them grow as needed by using the add method, which will grow to append the element.
Another way to define the list is by setting its length on creation. Lists with a fixed size cannot be expanded, so it's the developer's responsibility to know where and when to use ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access