ObservableList<E> class

Mixed-in types

Constructors

ObservableList({List<E>? initialData})
ObservableList.empty({bool growable = false})
factory
ObservableList.filled(int length, E fill, {bool growable = false})
factory
ObservableList.from(Iterable<E> elements, {bool growable = true})
factory
ObservableList.generate(int length, E generator(int index), {bool growable = true})
factory
ObservableList.of(Iterable<E> elements, {bool growable = true})
factory

Properties

first ↔ E
getter/setter pair
hashCode int
The hash code for this object.
no setteroverride
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isEmpty bool
no setter
isNotEmpty bool
no setter
last ↔ E
getter/setter pair
length int
getter/setter pair
list List<E>
no setter
reversed ObservableList<E>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(E toAdd) → void
Adds value to the end of this list, extending the length by one. The list must be growable.
addAll(Iterable<E> iterable) → void
Appends all objects of iterable to the end of this list. Extends the length of the list by the number of objects in iterable. The list must be growable.
addAllWhere(Iterable<E> iterable, bool condition(E t, List<E> currList)) → void
Appends to the end of this list, the objects of iterable that satisfy condition. The list must be growable.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
any(bool condition(E t, List<E> currList)) bool
Checks whether any element of this iterable satisfies test.
asMap() Map<int, E>
An unmodifiable Map view of this list. The map uses the indices of this list as keys and the corresponding objects as values. The Map.keys Iterable iterates the indices of this list in numerical order.
cast<R>() ObservableList<R>
clear() → void
contains(int id) bool
Whether the collection contains an element equal to element. This operation will check each element in order for being equal to element, unless it has a more efficient way to find an element equal to element. Stops iterating on the first equal element. The equality used to determine whether element is equal to an element of the iterable defaults to the Object.== of the element. Some types of iterable may have a different equality used for its elements. For example, a Set may have a custom equality (see Set.identity) that its contains uses. Likewise the Iterable returned by a Map.keys call should use the same equality that the Map uses for keys.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
fillRange(int start, int end, [E? fillValue]) → void
getRange(int start, int end) Iterable<E>
indexOf(E element, [int start = 0]) int
indexWhere(bool test(E element), [int start = 0]) int
insert(int index, E element) → void
Inserts element at position index in this list. This increases the length of the list by one and shifts all objects at or after the index towards the end of the list. The list must be growable. The index value must be non-negative and no greater than length.
insertAll(int index, Iterable<E> iterable) → void
lastIndexOf(E element, [int? start]) int
lastIndexWhere(bool test(E element), [int? start]) int
modify(List<E> applyChanges(List<E> list)) → void
allows to perform multiple changes to the list, and only notify listeners after all changes are through.
moveToIndex(int oldIndex, int newIndex) → void
Moves element to given newIndex.
none(bool condition(E t, List<E> currList)) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
remove(E toRemove) bool
removeAt(int index) → E
removeLast() → E
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeWhere(bool condition(E t, List<E> currList)) → void
replaceRange(int start, int end, Iterable<E> replacements) → void
reset() → void
retainWhere(bool test(E element)) → void
setAll(int index, Iterable<E> iterable) → void
setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0]) → void
shuffle([Random? random]) → void
Shuffles the elements of this list randomly.
sort([int compare(E a, E b)?]) → void
Sorts this list according to the order specified by the compare function.
sublist(int start, [int? end]) List<E>
toString() String
A string representation of this object.
inherited
update<T>(T updater()) → T
inherited

Operators

operator +(ObservableList<E> other) ObservableList<E>
operator ==(Object other) bool
The equality operator.
override
operator [](int index) → E
operator []=(int index, E value) → void

Static Methods

castFrom<S, T>(List<S> source) ObservableList<T>
copyRange<T>(ObservableList<T> target, int at, ObservableList<T> source, [int? start, int? end]) → void
writeIterable<T>(ObservableList<T> target, int at, Iterable<T> source) → void