getPost method

Future<PostModel?> getPost(
  1. String id
)

Returns a post with the given id.

Implementation

Future<PostModel?> getPost(String id) async {
  return instance.collection('posts').doc(id).get().then((snapshot) {
    if (snapshot.data() == null) return null;
    return PostModel.fromJsonAndId(snapshot.data()!, snapshot.id);
  });
}