Wednesday, March 22, 2023
HomeiOS Developmentiphone - I am unable to get calendar ID created by createCalendar...

iphone – I am unable to get calendar ID created by createCalendar perform for iOS


I attempted to get my calendar ID utilizing under code on each of iOS and android

getCalendarId() async {
  closing calendarsResult = await _deviceCalendarPlugin.retrieveCalendars();
  Checklist<Calendar> _calendars = calendarsResult.information as Checklist<Calendar>;

  String id = '';
  _calendars.forEach((ingredient) async {
    if (ingredient.title == 'My Calendar') {
    id = ingredient.id!;
      await SharedPreferencesRepository().setCalendarId(id);
    }
  });
  if (id == '') {
    var outcome = await _deviceCalendarPlugin.createCalendar(
      "My Calendar",
      calendarColor: Colours.blue,
      localAccountName: "My Calendar",
    );
    if (outcome.isSuccess) {
      closing calendarsResult = await _deviceCalendarPlugin.retrieveCalendars();
      Checklist<Calendar> _calendars = calendarsResult.information as Checklist<Calendar>;

      _calendars.forEach((ingredient) async {
        if (ingredient.title == 'My Calendar') {
          id = ingredient.id!;
          await SharedPreferencesRepository().setCalendarId(ingredient.id);
        }
      });
    } else {
      return id;
    }
  } else {
    return id;
  }
}


This code is working accurately for android however not iOS

This perform returns clean string for iOS. Why are the outputs totally different, and the way can I get this engaged on iOS?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments