deleteEventInstance method
Deletes an instance of a recurring event from a calendar. This should be used for a recurring event only.
If startDate
, endDate
or deleteFollowingInstances
is not valid or null, then all instances of the event will be deleted.
The calendarId
parameter is the id of the calendar that plugin will try to delete the event from
The eventId
parameter is the id of the event that plugin will try to delete
The startDate
parameter is the start date of the instance to delete
The endDate
parameter is the end date of the instance to delete
The deleteFollowingInstances
parameter will also delete the following instances if set to true
Returns a Result
indicating if the instance of the event has (true) or has not (false) been deleted from the calendar
Implementation
Future<Result<bool>> deleteEventInstance(
String? calendarId,
String? eventId,
int? startDate,
int? endDate,
bool deleteFollowingInstances,
) async {
return _invokeChannelMethod(
ChannelConstants.methodNameDeleteEventInstance,
assertParameters: (result) {
_validateCalendarIdParameter(
result,
calendarId,
);
_assertParameter(
result,
eventId?.isNotEmpty ?? false,
ErrorCodes.invalidArguments,
ErrorMessages.deleteEventInvalidArgumentsMessage,
);
},
arguments: () => <String, Object?>{
ChannelConstants.parameterNameCalendarId: calendarId,
ChannelConstants.parameterNameEventId: eventId,
ChannelConstants.parameterNameEventStartDate: startDate,
ChannelConstants.parameterNameEventEndDate: endDate,
ChannelConstants.parameterNameFollowingInstances:
deleteFollowingInstances,
},
);
}