Abstract implementation of a list.
Abstract implementation of a list.
ListBase
can be used as a base class for implementing the List
interface.
All operations are defined in terms of length
, operator[]
,
operator[]=
and length=
, which need to be implemented.
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, preferably, use DelegatingList
from
"package:collection/wrappers.dart" instead.