getActivity method

Future<ActivityModel?> getActivity(
  1. String id
)

Returns an activity with the given id.

If the activity does not exist, it returns null.

Implementation

Future<ActivityModel?> getActivity(String id) async {
  return instance.collection('activities').doc(id).get().then((snapshot) {
    if (snapshot.data() == null) return null;
    return ActivityModel.fromJson(snapshot.data()!);
  });
}