'Window with the ability to recover a deleted note from Firestore [duplicate]

My data is displayed from the Firestore. When I delete a note, I need a window to appear at the bottom where it is suggested to restore the deleted note.

Is it possible to implement this with Firestore? If so, how?

notes_list_page.dart

body: StreamBuilder<QuerySnapshot>(
    stream: Database().getMainCollection().snapshots(),
    builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
      if (snapshot.hasError) {
        return const Text('Something went wrong');
      }

      if (snapshot.connectionState == ConnectionState.waiting) {
        return const Center(child: CircularProgressIndicator());
      }
      return ListView.builder(
    itemCount: snapshot.data?.docs.length,
    itemBuilder: (context, index) {
      QueryDocumentSnapshot<Object?> documentSnapshot =
          snapshot.data!.docs[index];
      return Dismissible(
          key: Key(documentSnapshot.id),
          direction: DismissDirection.endToStart,
          onDismissed: (direction) {
            Database().deleteNote(documentSnapshot.id);
          },
          background: Container(
            padding: const EdgeInsets.only(right: 20),
            alignment: Alignment.centerRight,
            color: Colors.red,
            child: const Text(
              'Delete',
              style: TextStyle(color: Colors.white, fontSize: 16),
            ),
          ),
          child: ListTile(
            onTap: () => Navigator.push(
                context,
                MaterialPageRoute(
                    builder: ((context) => AddAndEditNotePage(
                          header: documentSnapshot['name'],
                          title: documentSnapshot['title'],
                          date: documentSnapshot['date'],
                          id: documentSnapshot.id,
                        )))),
            title: Text(documentSnapshot['name']),
            subtitle: Text(documentSnapshot['title']),
            trailing: Text(documentSnapshot['date'] ?? ''),
          ));
    });
    },
  ),


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source