onSnapshotSync method
Find first record (null if none) and listen for changes.
First emit happens synchronously.
Returns a single subscriber stream that must be cancelled.
Implementation
Stream<RecordSnapshot<K, V>?> onSnapshotSync(Database database) {
if (sembastQueryRef.finder?.limit != 1) {
return SembastQueryRef(
sembastQueryRef.store,
cloneFinderFindFirst(sembastQueryRef.finder),
).onSnapshotSync(database);
}
return onSnapshotsSync(
database,
).map((list) => list.isNotEmpty ? list.first : null);
}