watchList method
Opens a live stream for all items that match the given request details,
or the default RequestDetails.read object if not given.
Implementation
Stream<List<T>> watchList({RequestDetails? details}) async* {
await ready;
yield* sourceList
.watchList(
WatchListOperation<T>(
operationId: generateOperationId(),
details: details ?? RequestDetails.read(),
createdAt: getTime(),
),
)
.map((result) {
switch (result) {
case ReadListSuccess<T>():
return result.itemsOrRaise();
case ReadListFailure<T>():
return <T>[];
}
});
}