I'm trying to delete a post and all its sub-collections. When using the code below, I'm only able to delete all the fields in the post, but NOT the sub-collections it has.
FirebaseFirestore.instance.collection('posts').doc(postId).get().then((doc) {
if (doc.exists) {
doc.reference.delete();
}
What should I change to make it work? Thanks a lot!