openCalendarWithEvent static method

Future<bool> openCalendarWithEvent(
  1. CalendarEvent event
)

Opens the native calendar app with pre-filled event details.

This method opens the device's default calendar application with the event details pre-filled. The user can then review and save the event manually.

Returns true if the calendar was successfully opened, false otherwise.

Example:

final event = CalendarEvent(
  title: 'Meeting with Team',
  startDate: DateTime.now().add(Duration(hours: 1)),
  endDate: DateTime.now().add(Duration(hours: 2)),
  description: 'Discuss project progress',
  location: 'Conference Room A',
);

final success = await NativeCalendar.openCalendarWithEvent(event);
if (success) {
  print('Calendar opened successfully');
} else {
  print('Failed to open calendar');
}

Implementation

static Future<bool> openCalendarWithEvent(CalendarEvent event) {
  return NativeCalendarPlatform.instance.openCalendarWithEvent(event);
}