I'm trying to delete a sub-collection document from firestore using flutter, this is what my firestore database looks like.

firestore database

I have a logged in user and a page to view all the products that they have created and next to that an iconbutton with:

onPressed: () => Firestore.instance
                          .collection('products')
                          .document(widget.currentUserId)
                          .collection('usersProducts')
                          .document(product.id)
                          .delete()
                          .catchError(
                            (e) => print(e),
                          ),

but it doesn't work. Can anyone help with this?