addPostToProfile method

  1. @override
void addPostToProfile(
  1. String postId
)
override

Implementation

@override
void addPostToProfile(String postId) {
  _profile.posts ??= [];
  if (!_profile.posts!.contains(postId)) {
    _profile.posts!.add(postId);
  }
  for (var prof in _user.profiles) {
    if (prof.id == _profile.id) {
      prof.posts ??= [];
      if (!prof.posts!.contains(postId)) {
        prof.posts!.add(postId);
      }
    }
  }
  update();
}