removePostFromProfile method

  1. @override
void removePostFromProfile(
  1. String postId, {
  2. String? ownerId,
})
override

Implementation

@override
void removePostFromProfile(String postId, {String? ownerId}) {
  if (ownerId == null || ownerId.isEmpty || ownerId == _profile.id) {
    _profile.posts?.removeWhere((id) => id == postId);
    for (var prof in _user.profiles) {
      if (prof.id == _profile.id) {
        prof.posts?.removeWhere((id) => id == postId);
      }
    }
  }
  _postRemovedController.add(postId);
  update();
}