getCalendars method

Future<List<Calendar>?> getCalendars()

Returns the available calendars from the device

Implementation

Future<List<Calendar>?> getCalendars() async {
  List<Calendar>? calendars = [];
  try {
    String calendarsJson = await _channel.invokeMethod('getCalendars');
    calendars = json.decode(calendarsJson).map<Calendar>((decodedCalendar) {
      return Calendar.fromJson(decodedCalendar);
    }).toList();
  } catch (e) {
    print(e);
  }
  return calendars;
}