StreamList<E> class

StreamList wraps a List and adds functionality to each relevant method to notify any subscribed listeners of changes made to the list.

Inheritance
Implemented types
Available Extensions

Constructors

StreamList({List<E>? value, OnUpdate<List<E>>? onUpdate, OnEvent<CollectionEvent<int, E>>? onEvent, OnChange<CollectionChangeEvent<int, E>>? onChange})
StreamList wraps a List and adds functionality to each relevant method to notify any subscribed listeners of changes made to the list.
StreamList.filled(int length, E fill, {bool growable = false, OnUpdate<List<E>>? onUpdate, OnEvent<CollectionEvent<int, E>>? onEvent, OnChange<CollectionChangeEvent<int, E>>? onChange})
Creates a list of the given length with fill at each position.
factory
StreamList.from(Iterable elements, {bool growable = true, OnUpdate<List<E>>? onUpdate, OnEvent<CollectionEvent<int, E>>? onEvent, OnChange<CollectionChangeEvent<int, E>>? onChange})
Creates a list containing all elements.
factory
StreamList.generate(int count, _Generator<E> generator, {bool growable = true, OnUpdate<List<E>>? onUpdate, OnEvent<CollectionEvent<int, E>>? onEvent, OnChange<CollectionChangeEvent<int, E>>? onChange})
Generates a list of values.
factory
StreamList.of(Iterable<E> elements, {bool growable = true, OnUpdate<List<E>>? onUpdate, OnEvent<CollectionEvent<int, E>>? onEvent, OnChange<CollectionChangeEvent<int, E>>? onChange})
Creates a list from elements.
factory

Properties

first ↔ E
The first element.
getter/setter pairoverride
hasChangeEvent bool
Returns true if there are any active change listeners or if onChange is set.
no setterinherited
hasChangeListener bool
Returns true if there are any active change listeners.
no setterinherited
hasEvent bool
Returns true if there are any active event listeners or if onEvent is set.
no setterinherited
hasEventListener bool
Returns true if there are any active event listeners.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListener bool
Returns true if there are any active listeners.
no setterinherited
hasUpdate bool
Returns true if there are any active update listeners or if onUpdate is set.
no setterinherited
isEmpty bool
Whether this collection has no elements.
no setteroverride
isNotEmpty bool
Whether this collection has at least one element.
no setteroverride
isObserved bool
Returns true if there are any active listeners or if onUpdate is not null.
no setterinherited
iterator Iterator<E>
A new Iterator that allows iterating the elements of this Iterable.
no setteroverride
last ↔ E
The last element.
getter/setter pairoverride
length int
The number of objects in this list.
getter/setter pairoverride
numberOfChangeListeners int
Returns the number of active change listeners.
no setterinherited
numberOfEventListeners int
Returns the number of active event listeners.
no setterinherited
numberOfListeners int
Returns the number of active listeners.
no setterinherited
onChange ↔ OnChange<CollectionChangeEvent<int, E>>?
A synchronous event called individually for every element added, removed, or updated in the collection.
getter/setter pairinherited
onEvent ↔ OnEvent<CollectionEvent<int, E>>?
Called when an element is added, removed, or updated in the list/map before onUpdate is called and before the listeners are notified of the new value.
getter/setter pairinherited
onUpdate ↔ OnUpdate<List<E>>?
Called after value is updated, before the listeners are notified.
getter/setter pairinherited
reversed Iterable<E>
An Iterable of the objects in this list in reverse order.
no setteroverride
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
value List<E>
The value being observed.
getter/setter pairinherited
wasDisposed bool
Set to true when dispose is called.
getter/setter pairinherited

Methods

add(E value, {bool notifyListeners = true}) → void
Adds value to the end of this list, extending the length by one.
override
addAll(Iterable<E> iterable, {bool notifyListeners = true}) → void
Appends all objects of iterable to the end of this list.
override
addChangeListener(OnChange<CollectionChangeEvent<int, E>> onChange) StreamSubscription<CollectionChangeEvent<int, E>>
Registers a new StreamSubscription that provides a CollectionChangeEvent denoting when an element has been added, removed, or updated in the collection.
inherited
addEventListener(OnEvent<CollectionEvent<int, E>> onEvent) StreamSubscription<CollectionEvent<int, E>>
Registers a new StreamSubscription that provides a CollectionEvent denoting when any elements have been added, removed, or updated in the collection.
inherited
addListener(OnUpdate<List<E>> onUpdate) StreamSubscription<List<E>>
Creates, stores and returns a listener.
inherited
any(Test<E> test) bool
Checks whether any element of this iterable satisfies test.
override
asMap() Map<int, E>
An unmodifiable Map view of this list.
override
cast<R>() StreamList<R>
Returns a view of this list as a list of R instances.
override
clear({bool notifyListeners = true}) → void
Removes all objects from this list; the length of the list becomes zero.
override
contains(Object? element) bool
Whether the collection contains an element equal to element.
override
dispose() → void
Cancels any active listeners and closes the stream.
inherited
elementAt(int index) → E
Returns the indexth element.
override
every(Test<E> test) bool
Checks whether every element of this iterable satisfies test.
override
expand<T>(_Expand<T, E> f) Iterable<T>
Expands each element of this Iterable into zero or more elements.
override
fillRange(int start, int end, [E? fillValue, bool notifyListeners = true]) → void
Overwrites a range of elements with fillValue.
override
firstWhere(Test<E> test, {_OrElse<E>? orElse}) → E
The first element that satisfies the given predicate test.
override
fold<T>(T initialValue, _Fold<T, E> combine) → 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(_ForEach<E> f) → void
Invokes action on each element of this iterable in iteration order.
override
getRange(int start, int end) Iterable<E>
Creates an Iterable that iterates over a range of elements.
override
indexOf(E element, [int start = 0]) int
The first index of element in this list.
override
indexWhere(Test<E> test, [int start = 0]) int
The first index in the list that satisfies the provided test.
override
insert(int index, E element, {bool notifyListeners = true}) → void
Inserts element at position index in this list.
override
insertAll(int index, Iterable<E> iterable, {bool notifyListeners = true}) → void
Inserts all objects of iterable at position index in this list.
override
join([String separator = '']) String
Converts each element to a String and concatenates the strings.
override
lastIndexOf(E element, [int? start]) int
The last index of element in this list.
override
lastIndexWhere(Test<E> test, [int? start]) int
The last index in the list that satisfies the provided test.
override
lastWhere(Test<E> test, {_OrElse<E>? orElse}) → E
The last element that satisfies the given predicate test.
override
map<T>(_Mapper<T, E> f) 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
notifyAllListeners(CollectionEventType type, int? key, E? value) → void
Notifies every active update, event, and change listener, as well as the onUpdate, onEvent, and onChange parameters of an event affecting a single element.
inherited
notifyChangeListeners(CollectionChangeEvent<int, E> event) → void
Notifies all subscribed changes listeners of an event.
inherited
notifyEventListeners(CollectionEvent<int, E> event) → void
Notifies all subscribed event listeners of an event.
inherited
notifyListeners(List<E> event) → void
Notifies all subscribed listeners of an event.
inherited
reduce(_Combine<E> combine) → E
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
override
remove(Object? value, {bool notifyListeners = true}) bool
Removes the first occurrence of value from this list.
override
removeAt(int index, {bool notifyListeners = true}) → E
Removes the object at position index from this list.
override
removeChangeListener() → void
Cancels and removes a change listener.
inherited
removeEventListener() → void
Cancels and removes an event listener.
inherited
removeLast({bool notifyListeners = true}) → E
Removes and returns the last object in this list.
override
removeListener() → void
Cancels and removes a StreamSubscription.
inherited
removeRange(int start, int end, {bool notifyListeners = true}) → void
Removes a range of elements from the list.
override
removeWhere(Test<E> test, {bool notifyListeners = true}) → void
Removes all objects from this list that satisfy test.
override
replaceRange(int start, int end, Iterable<E> replacement, {bool notifyListeners = true}) → void
Removes the objects in the range start inclusive to end exclusive and inserts the contents of replacement in its place.
override
retainWhere(Test<E> test, {bool notifyListeners = true}) → void
Removes all objects from this list that fail to satisfy test.
override
reverse({bool notifyListeners = true}) → void
Reverses the order of the elements in this list.
setAll(int index, Iterable<E> iterable, {bool notifyListeners = true}) → void
Overwrites elements with the objects of iterable.
override
setRange(int start, int end, Iterable<E> iterable, [int skipCount = 0, bool notifyListeners = true]) → void
Writes some elements of iterable into a range of this list.
override
setValue(List<E> value) → void
Sets the observable value to value without notifying the event listeners.
inherited
shuffle([Random? random]) → void
Shuffles the elements of this list randomly.
override
silentShuffle([Random? random]) → void
shuffles the list without notifying any listeners.
silentSort([_Compare<E>? compare]) → void
sorts the list without notifying any listeners.
singleWhere(Test<E> test, {_OrElse<E>? orElse}) → E
The single element that satisfies test.
override
skip(int count) Iterable<E>
Creates an Iterable that provides all but the first count elements.
override
skipWhile(Test<E> test) Iterable<E>
Creates an Iterable that skips leading elements while test is satisfied.
override
sort([_Compare<E>? compare]) → void
Sorts this list according to the order specified by the compare function.
override
sublist(int start, [int? end]) List<E>
Returns a new list containing the elements between start and end.
override
take(int count) Iterable<E>
Creates a lazy iterable of the count first elements of this iterable.
override
takeWhile(Test<E> test) Iterable<E>
Creates a lazy iterable of the leading elements satisfying test.
override
toList({bool growable = true}) List<E>
Creates a List containing the elements of this Iterable.
override
toSet() Set<E>
Creates a Set containing the same elements as this iterable.
override
toString() String
A string representation of this object.
inherited
where(Test<E> test) 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 +(List<E> other) StreamList<E>
Returns the concatenation of this list and other.
override
operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) → E
The object at the given index in the list.
override
operator []=(int index, E value) → void
Sets the value at the given index in the list to value.
override

Static Methods

castFrom<S, T>(List<S> source, {OnUpdate<List<T>>? onUpdate, OnEvent<CollectionEvent<int, T>>? onEvent, OnChange<CollectionChangeEvent<int, T>>? onChange}) StreamList<T>
Adapts source to be a StreamList<T>.
override