fetchMonthEvents method

Future<List<CalendarMonthEvent>> fetchMonthEvents({
  1. String? templateId,
  2. required DateTime displayDate,
  3. required bool parentElementsOnly,
})

Fetches the calendar events for a specific month.

Implementation

Future<List<CalendarMonthEvent>> fetchMonthEvents({
  String? templateId,
  required DateTime displayDate,
  required bool parentElementsOnly,
}) async {
  final cacheKey = _getMonthCacheKey(displayDate, parentElementsOnly);
  if (_cache.containsKey(cacheKey)) {
    return _cache[cacheKey]!;
  }

  final events = await apiInterface.fetchMonthEvents(
    templateId: templateId,
    displayDate: displayDate,
    parentElementsOnly: parentElementsOnly,
  );
  _cache[cacheKey] = events;
  return events;
}