getEventsByDateRange method
Returns all the available events on the given date Range
Implementation
Future<List<CalendarEvent>?> getEventsByDateRange({
required String calendarId,
required DateTime startDate,
required DateTime endDate,
}) async {
List<CalendarEvent>? events = [];
try {
String eventsJson =
await _channel.invokeMethod('getEventsByDateRange', <String, Object?>{
'calendarId': calendarId,
'startDate': startDate.millisecondsSinceEpoch,
'endDate': endDate.millisecondsSinceEpoch,
});
events =
json.decode(eventsJson).map<CalendarEvent>((decodedCalendarEvent) {
return CalendarEvent.fromJson(decodedCalendarEvent);
}).toList();
} catch (e) {
print(e);
}
return events;
}