Closed Kapil619 closed 7 months ago
I fixed the issue by changing this in the code =>
onTap: () async {
user.uid == widget.snap['uid']
? await FirestoreMethods().deletePost( widget.snap['postId'], )
: showSnackBar(
"Unable TO delete Post", context);
Navigator.of(context).pop(); },
ListView( padding: const EdgeInsets.symmetric(vertical: 16), shrinkWrap: true, children: ['Delete'] .map( (e) => InkWell( onTap: () async { FirestoreMethods().deletePost( widget.snap['postId'], ); Navigator.of(context).pop(); }, child: Container( padding: const EdgeInsets.symmetric( vertical: 12, horizontal: 16, ), child: Text(e), ), ), )
As we don't check for, If logged in user is same as the user who posted, It causes this bug.