BuiltList<E> class
abstract
The Built Collection List.
It implements Iterable and the non-mutating part of the List interface. Modifications are made via ListBuilder.
See the
Built Collection library documentation
(#built_collection/built_collection)
for the general properties of Built Collections.
- Implemented types
-
- Iterable<
E>
- Iterable<
- Available extensions
Constructors
- BuiltList([Iterable iterable = const []])
-
Instantiates with elements from an Iterable.
factory
-
BuiltList.build(dynamic updates(ListBuilder<
E> )) -
Creates a ListBuilder, applies updates to it, and builds.
factory
- BuiltList.from(Iterable iterable)
-
Instantiates with elements from an Iterable.
factory
-
BuiltList.of(Iterable<
E> iterable) -
Instantiates with elements from an Iterable<E>.
factory
Properties
- first → E
-
The first element.
no setteroverride
- firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - hashCode → int
-
Deep hashCode.
no setteroverride
-
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter - isEmpty → bool
-
Whether this collection has no elements.
no setteroverride
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setteroverride
-
iterator
→ Iterator<
E> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setteroverride - last → E
-
The last element.
no setteroverride
- lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - length → int
-
As List.length.
no setteroverride
-
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnull
elements of this iterable.no setter -
reversed
→ Iterable<
E> -
As List.reversed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → E
-
Checks that this iterable has only one element, and returns that element.
no setteroverride
- singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull
.no setter -
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures in parallel.Future< , provided by the FutureIterable extensionT> >no setter
Methods
-
any(
bool test(E)) → bool -
Checks whether any element of this iterable satisfies
test
.override -
asList(
) → List< E> - Returns as an immutable list.
-
asMap(
) → Map< int, E> - As List.asMap.
-
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname
. -
cast<
T> () → Iterable< T> -
A view of this iterable as an iterable of
R
instances.override -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.override -
elementAt(
int index) → E -
Returns the
index
th element.override -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindex
of this iterable, ornull
. -
every(
bool test(E)) → bool -
Checks whether every element of this iterable satisfies
test
.override -
expand<
T> (Iterable< T> f(E)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
override
-
firstWhere(
bool test(E), {E orElse()?}) → E -
The first element that satisfies the given predicate
test
.override -
fold<
T> (T initialValue, T combine(T, E)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
override
-
followedBy(
Iterable< E> other) → Iterable<E> -
Creates the lazy concatenation of this iterable and
other
.override -
forEach(
void f(E)) → void -
Invokes
action
on each element of this iterable in iteration order.override -
getRange(
int start, int end) → Iterable< E> - As List.getRange.
-
indexOf(
E element, [int start = 0]) → int - As List.indexOf.
-
indexWhere(
bool test(E), [int start = 0]) → int - As List.indexWhere.
-
join(
[String separator = '']) → String -
Converts each element to a String and concatenates the strings.
override
-
lastIndexOf(
E element, [int? start]) → int - As List.lastIndexOf.
-
lastIndexWhere(
bool test(E), [int? start]) → int - As List.lastIndexWhere.
-
lastWhere(
bool test(E), {E orElse()?}) → E -
The last element that satisfies the given predicate
test
.override -
map<
T> (T f(E)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rebuild(
dynamic updates(ListBuilder< E> )) → BuiltList<E> - Converts to a ListBuilder, applies updates to it, and builds.
-
reduce(
E combine(E, E)) → E -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
override
-
singleWhere(
bool test(E), {E orElse()?}) → E -
The single element that satisfies
test
.override -
skip(
int n) → Iterable< E> -
Creates an Iterable that provides all but the first
count
elements.override -
skipWhile(
bool test(E)) → Iterable< E> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.override -
sublist(
int start, [int? end]) → BuiltList< E> -
As List.sublist but returns a
BuiltList<E>
. -
take(
int n) → Iterable< E> -
Creates a lazy iterable of the
count
first elements of this iterable.override -
takeWhile(
bool test(E)) → Iterable< E> -
Creates a lazy iterable of the leading elements satisfying
test
.override -
toBuilder(
) → ListBuilder< E> - Converts to a ListBuilder for modification.
-
toBuiltList(
) → BuiltList< E> -
Available on Iterable<
Converts to a BuiltList.E> , provided by the BuiltListIterableExtension extension -
toBuiltList(
) → BuiltList< E> - Converts to a BuiltList.
-
toBuiltSet(
) → BuiltSet< E> - Converts to a BuiltSet.
-
toBuiltSet(
) → BuiltSet< E> -
Available on Iterable<
Converts to a BuiltSet.E> , provided by the BuiltSetIterableExtension extension -
toList(
{bool growable = true}) → List< E> -
As Iterable.toList.
override
-
toSet(
) → Set< E> -
Creates a Set containing the same elements as this iterable.
override
-
toString(
) → String -
A string representation of this object.
override
-
where(
bool test(E)) → Iterable< E> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.override -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.override
Operators
-
operator +(
BuiltList< E> other) → BuiltList<E> - As List.+.
-
operator ==(
Object other) → bool -
Deep equality.
override
-
operator [](
int index) → E - As List.elementAt.