replacePost method

PostListPagedState replacePost(
  1. PostDetails value
)

Implementation

PostListPagedState replacePost(PostDetails value) {
  List<PostDetails> newValues = [];
  for (int i = 0; i < values.length; i++) {
    if (values[i].postModel.documentID != value.postModel.documentID) {
      newValues.add(values[i]);
    } else {
      newValues.add(value);
    }
  }

  return copyWith(
    values: newValues,
  );
}