SunnyObservableList<V>.ofStream constructor
SunnyObservableList<V>.ofStream (})
Implementation
SunnyObservableList.ofStream(Stream<Iterable<V>> stream,
{FutureOr<Iterable<V>>? start,
this.diffAlgorithm,
this.diffEquality = const DiffEquality(),
String? debugLabel})
: debugLabel = debugLabel ?? "stream[${V.simpleName}]",
super() {
this.sync(start).then((_) {
final subscription = stream.asyncMap((newList) {
try {
log.fine(
"got sync event from upstream with ${newList.length} records");
this.sync(newList);
} catch (e) {
print(e);
}
}).listen(
(_) {},
cancelOnError: false,
);
disposers.add(subscription.cancel);
});
}