Reservoir<PrimaryKey extends Key<Record>, Record extends Object> class

Mixed in types
Available Extensions

Constructors

Reservoir(PrimaryKey keyType)
Construct a Reservoir from a source. Requires getKey as a function that maps a Record to a Key, so that the Reservoir can construct a primaryIndex.

Properties

batchedChanges Stream<List<Change<Record>>>
Expose the stream of changes that can be subscribed to
no setter
changes Stream<Change<Record>>
Return each change individually as a stream
no setter
data Iterable<Record>
Return all records in the Reservoir
no setter
first → Record
The first element.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
indices Map<String, Index<Key<Record>, Record>>
final
isEmpty bool
Whether this collection has no elements.
no setterinherited
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<Record>
Allow to iterate over all the records in the Reservoir e.g. for (row in reservoir) { ... }
no setteroverride
last → Record
The last element.
no setterinherited
length int
The number of elements in this.
no setterinherited
primaryIndex IndexUnique<PrimaryKey, Record>
Return the primaryIndex from the set of indices
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single → Record
Checks that this iterable has only one element, and returns that element.
no setterinherited
source Source<Record>
getter/setter pair

Methods

addIndexMultiple<K extends Key<Record>>(String name, K keyType, [Compare? compare]) IndexMultiple<K, Record>
Create a 'multiple' index and add all current records to it
addIndexUnique<K extends Key<Record>>(String name, K keyType) IndexUnique<K, Record>
Create a unique index and add all current records to it
any(bool test(Record element)) 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
clear() Future<List<Change>>
Clear all data in reservoir, including all indices
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
elementAt(int index) → Record
Returns the indexth element.
inherited
every(bool test(Record element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(Record element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(Record element), {Record orElse()?}) → Record
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, Record element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<Record> other) Iterable<Record>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(Record element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(Record element), {Record orElse()?}) → Record
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(Record 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
primaryKey(dynamic record) String
Given a record, return its key as stored in the primaryIndex
reduce(Record combine(Record value, Record element)) → Record
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
remove(Record record) Future<Change<Record>?>
Remove a record, de-index it, and broadcast the change
removeAll(Iterable<Record> records) Future<List<Change>>
Remove all records, de-index them, and broadcast the changes
save(Record record) Future<Change<Record>?>
Save a record, index it, and broadcast the change
saveAll(Iterable<Record> records) Future<List<Change>>
Save all records, index them, and broadcast the changes
setSource(Source<Record> source) → dynamic
singleWhere(bool test(Record element), {Record orElse()?}) → Record
The single element that satisfies test.
inherited
skip(int count) Iterable<Record>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(Record value)) Iterable<Record>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<Record>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(Record value)) Iterable<Record>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<Record>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<Record>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
override
where(bool test(Record element)) Iterable<Record>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

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