flutter-firestore:如何从列表视图中删除 n 天前的项目

flutter-firestore: how to delete item n days old from listview

我想在我的 flutter-firestore 应用程序的页面中自动从列表视图中删除超过 10 天的项目。这是我创建该列表视图的代码。

body: StreamBuilder(
      stream: FirebaseFirestore.instance
          .collection('notifs')
          .orderBy('notifTimestamp', descending: true)
          .snapshots(),
      builder:
          (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
        if (!snapshot.hasData) {
          return Text('Loading...');
        }
        return ListView.builder(
            itemCount: snapshot.data.docs.length,
            itemBuilder: (_, index) {
              return Card(
                child: Column(
                  children: [
                    ...
 ]))}

如何自动删除超过 10 年的列表项?

'notifTimestamp' 保存在 DartDate 变量中 Dart

    DateTime tenDaysOld=DateTime.now().subtract(Duration(days: 10));

    FirebaseFirestore.instance
          .collection('notifs')
          .orderBy('notifTimestamp', descending: true)
          .startAt([tenDaysOld]).snapshots();