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?