我想显示满足以下两个条件的数据:
我该如何实现这一目标:
当前,我有以下内容仅返回'done'为假的项目。
yield* userDoc.todoCollection
.orderBy('serverTimeStamp', descending: true)
.snapshots()
.map(
(snapshot) => snapshot.documents
.map((doc) => TodoDto.fromFirestore(doc).toDomain()),
)
.map(
(todos) => right<TodoFailure, KtList<TodoItem>>(
todos
.where(
(todo) =>
!todo.done,
)
.toImmutableList(),
),
)
答案 0 :(得分:0)
在where
函数中尝试以下条件:
!todo.done || (todo.done && (todo.time as DateTime).isAfter(DateTime(DateTime.now().year,DateTime.now().month,DateTime.now().day)))