ListMixin<E> typedef

ListMixin<E> = ListBase<E>

Base mixin implementation of a List class.

ListMixin can be used as a mixin to make a class implement the List interface.

This mixin implements all read operations using only the length and operator[] and members. It implements write operations using those and add, length= and operator[]=. Classes using this mixin should implement those five operations.

NOTICE: For backwards compatibility reasons, there is a default implementation of add which only works for lists with a nullable element type. For lists with a non-nullable element type, the add method must be implemented.

NOTICE: Forwarding just the four length and [] read/write operations to a normal growable List (as created by a [] literal) will give very bad performance for add and addAll operations of ListMixin. These operations are implemented by increasing the length of the list by one for each add operation, and repeatedly increasing the length of a growable list is not efficient. To avoid this, override 'add' and 'addAll' to also forward directly to the growable list, or, if possible, use DelegatingList from "package:collection/collection.dart" instead of a ListMixin.


// TODO: @Deprecated("Use List instead")
typedef ListMixin<E> = ListBase<E>;