Base implementation of a List class.
ListMixin
can be used as a mixin to make a class implement
the List
interface.
This implements all read operations using only the length
and
operator[]
members. It implements write operations using those and
length=
and operator[]=
NOTICE: Forwarding just these four operations to a normal growable List
(as created by new List()
) will give very bad performance for add
and
addAll
operations of ListBase
. 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, either override 'add' and 'addAll' to also forward directly
to the growable list, or, if possible, use DelegatingList
from
"package:collection/wrappers.dart" instead.