ComponentList class

The ordered container for a Component's Component.children.

Components are ordered by Component.priority, or by the comparator if one was supplied through Component.createComponentList; components that compare equal keep the order in which they were added. Iterating the list, directly or through reversed, visits the components in that order.

The contents are managed by the component lifecycle: use Component.add, Component.remove and their related methods to change which components are in the list. Removing a component while iterating the list is allowed, the removed component is simply no longer visited. Reordering the list while iterating it (through Component.rebalanceChildren, or by an addition that does not end up at the end of the list) makes live iterators throw a ConcurrentModificationError.

Components of a specific type can be retrieved in constant time with query, once the type has been registered with register.

Inheritance
Available extensions

Constructors

ComponentList({bool strictMode = false, Comparator<Component>? comparator})

Properties

comparator → Comparator<Component>?
An optional custom ordering, replacing the default ordering by Component.priority. Supply one via Component.createComponentList.
final
first → Component
The first element.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
isEmpty → bool
Whether this collection has no elements.
no setteroverride
isNotEmpty → bool
Whether this collection has at least one element.
no setteroverride
iterator → Iterator<Component>
A new Iterator that allows iterating the elements of this Iterable.
no setteroverride
last → Component
The last element.
no setteroverride
length → int
The number of elements in this Iterable.
no setteroverride
loaded → Future<void>

Available on Iterable<Component>, provided by the ComponentIterableExtension extension

A future that completes when every component in this iterable has finished loading.
no setter
mounted → Future<void>

Available on Iterable<Component>, provided by the ComponentIterableExtension extension

A future that completes when every component in this iterable has been mounted on its parent.
no setter
removed → Future<void>

Available on Iterable<Component>, provided by the ComponentIterableExtension extension

A future that completes when every component in this iterable has been removed from its parent.
no setter
reversed → Iterable<Component>
The elements of this list in reverse order.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
single → Component
Checks that this iterable has only one element, and returns that element.
no setterinherited
strictMode → bool
Whether calling query for an unregistered type throws an error (true), or registers the type on first use (false).
final

Methods

any(bool test(Component c)) → bool
Checks whether any element of this iterable satisfies test.
inherited
cast<R>() → Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
contains(Object? element) → bool
Whether the collection contains an element equal to element.
override
elementAt(int index) → Component
Returns the indexth element.
override
every(bool test(Component c)) → bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(Component element)) → Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(Component c), {Component orElse()?}) → Component
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, Component element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<Component> other) → Iterable<Component>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(Component component)) → void
Invokes action on each element of this iterable in iteration order.
override
isRegistered<C extends Component>() → bool
Whether type C has been registered as a queryable type.
join([String separator = ""]) → String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(Component c), {Component orElse()?}) → Component
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(Component e)) → Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query<C extends Component>() → Iterable<C>
All elements of type C, in priority order, in constant time.
reduce(Component combine(Component value, Component element)) → Component
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
register<C extends Component>() → void
Registers C as a queryable type, so that query can answer in constant time. Does nothing if the type is already registered.
singleWhere(bool test(Component c), {Component orElse()?}) → Component
The single element that satisfies test.
inherited
skip(int count) → Iterable<Component>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(Component c)) → Iterable<Component>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) → Iterable<Component>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(Component c)) → Iterable<Component>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) → List<Component>
Creates a List containing the elements of this Iterable.
inherited
toSet() → Set<Component>
Creates a Set containing the same elements as this iterable.
inherited
toString() → String
Returns a string representation of (some of) the elements of this.
inherited
where(bool test(Component c)) → Iterable<Component>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<C>() → Iterable<R>
Creates a new lazy Iterable with all elements that have type T.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited