activitiesBetweenTwoDates method

Future<List<ActivityModel>> activitiesBetweenTwoDates(
  1. DateTime lowerBound,
  2. DateTime upperBound
)

Returns a list of activities that are happening between two dates.

Implementation

Future<List<ActivityModel>> activitiesBetweenTwoDates(
  DateTime lowerBound,
  DateTime upperBound,
) {
  return instance
      .collection('activities')
      .where('date.startDate', isGreaterThanOrEqualTo: lowerBound)
      .where('date.startDate', isLessThan: upperBound)
      .withConverter(
        fromFirestore: (snapshot, _) =>
            ActivityModel.fromJson(snapshot.data()!),
        toFirestore: (_, __) => {},
      )
      .get()
      .then((snapshot) => snapshot.docs.map((doc) => doc.data()).toList());
}