isarTakeIds<R extends HasIsarId> function
Stream<IList<Id> > Function(int size)
isarTakeIds<R extends HasIsarId>({
- required IsarCollection<
R> collection, - required QueryBuilder<
R, R, QAfterWhere> sortProp(- QueryBuilder<
R, R, QWhere> query
- QueryBuilder<
- Sort sortOrder = Sort.desc,
Implementation
Stream<IList<Id>> Function(int size) isarTakeIds<R extends HasIsarId>({
required IsarCollection<R> collection,
required QueryBuilder<R, R, QAfterWhere> Function(
QueryBuilder<R, R, QWhere> query)
sortProp,
Sort sortOrder = Sort.desc,
}) {
QueryBuilder<R, int, QQueryOperations> idProperty(
QueryBuilder<R, R, QQueryProperty> query) {
// ignore: invalid_use_of_protected_member
return QueryBuilder.apply(query, (query) {
return query.addPropertyName(r'id');
});
}
return (size) => collection
.watchLazy(fireImmediately: true)
.asyncMap(
(_) => collection
.where(sort: sortOrder)
.let(sortProp)
.limit(size)
.let(idProperty)
.findAll(),
)
.map(
(e) => e.toIList(),
);
}