getEvents method
Returns all the available events in the selected calendar
Implementation
Future<List<CalendarEvent>?> getEvents({required String calendarId}) async {
List<CalendarEvent>? events = [];
try {
String eventsJson = await _channel.invokeMethod(
'getEvents', <String, Object?>{'calendarId': calendarId});
events =
json.decode(eventsJson).map<CalendarEvent>((decodedCalendarEvent) {
return CalendarEvent.fromJson(decodedCalendarEvent);
}).toList();
} catch (e) {
print(e);
}
return events;
}