getCalendars method

Future<List<Calendar>?> getCalendars()

Gets all the possible calendars on the device.

Returns a list of calendars that are not read-only, are default, and have a name.

Implementation

Future<List<Calendar>?> getCalendars() {
  return deviceCalendarPlugin.retrieveCalendars().then((calendars) {
    return calendars.data
        ?.where(
          (element) =>
              element.isReadOnly == false &&
              element.isDefault == true &&
              element.name != null,
        )
        .toList();
  });
}