OffsetIterator<T> class

Available Extensions

Constructors

OffsetIterator({InitCallback? init, required ProcessCallback<T> process, CleanupCallback? cleanup, SeedCallback<T>? seed, int retention = 0, bool cancelOnError = true, String? name})

Properties

buffer Queue<T>
The buffer contains items that have yet to be pulled. The process function can return a chunk of multiple items, but because pull only returns one item at a time, the extra items are buffered.
final
cancelOnError bool
If true, cancel will be called on error.
final
drained bool
Returns true if all the data has been pulled.
no setter
earliestAvailableOffset int
The earliest offset that still has a value
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
log Queue<Option<T>>
The log contains previously pulled items. Retention is controlled by the rentention property.
final
name String
final
offset int
The current head offset.
no setter
retention int
How many items to retain in the log. If set to a negative number (e.g. -1), it will retain everything. Defaults to 0 (retains nothing).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state OffsetIteratorState<T>
The latest state from the process function.
getter/setter pair
status OffsetIteratorStatus
The internal status
no setter
value Option<T>
Get the current head value as an option.
no setter
valueOrNull → T?
Get the current head value, or null.
no setter

Methods

cancel() FutureOr<void>
Prevents any new items from being added to the buffer and performs any optional cleanup.
generateCleanup({CleanupCallback? cleanup, bool bubbleCancellation = true}) CleanupCallback?
Helper method to generate a CleanupCallback
generateSeed({int? startOffset, SeedCallback<T>? override, SeedCallback<T>? fallback}) SeedCallback<T>?
hasMore([int? offset]) bool
Check if there is more items after the specified offset. If no offset it specified, it uses the head offset.
isLastOffset(int offset) bool
Checks if the specified offset is the last item.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pull([int? currentOffset]) FutureOr<Option<T>>
Pull the next item. If currentOffset is not provided, it will use the latest head offset.
toString() String
A string representation of this object.
override
toStringWithChild(String name) String
valueAt(int offset) Option<T>

Operators

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

Static Methods

combine<T>(Iterable<OffsetIterator<T>> iterators, {String name = 'OffsetIterator.combine', bool closeOnError = true, SeedCallback<T>? seed}) OffsetIterator<T>
Combine multiple OffsetIterator's into one.
fromFuture<T>(Future<T> future(), {String name = 'OffsetIterator.fromFuture', SeedCallback<T>? seed}) OffsetIterator<T>
fromIterable<T>(Iterable<T> iterable, {String name = 'OffsetIterator.fromIterable', int retention = 0, SeedCallback<T>? seed}) OffsetIterator<T>
Create an OffsetIterator from the provided Iterable.
fromStream<T>(Stream<T> stream, {int retention = 0, SeedCallback<T>? seed, String name = 'OffsetIterator.fromStream', bool cancelOnError = true}) OffsetIterator<T>
Create an OffsetIterator from the provided Stream. If a ValueStream with a seed is given, it will populate the iterator's seed value.
fromStreamEither<T>(Stream<T> stream, {int retention = 0, SeedCallback<Either<dynamic, T>>? seed, String name = 'OffsetIterator.fromStreamEither'}) OffsetIterator<Either<dynamic, T>>
Create an OffsetIterator from the provided Stream. If a ValueStream with a seed is given, it will populate the iterator's seed value.
fromValue<T>(T value, {String name = 'OffsetIterator.fromValue', SeedCallback<T>? seed}) OffsetIterator<T>
range(int start, {int? end, String name = 'OffsetIterator.range', int retention = 0, SeedCallback<int>? seed}) OffsetIterator<int>