editEvent method
Implementation
Future<dynamic> editEvent() async {
try {
var atKey = getAtKey(eventNotificationModel!.key!);
var allAtsignList = <String?>[];
EventService().eventNotificationModel!.group!.members!.forEach((element) {
allAtsignList.add(element.atSign);
});
var eventData = EventNotificationModel.convertEventNotificationToJson(
EventService().eventNotificationModel!);
var result = await atClientInstance!
.put(atKey, eventData, isDedicated: MixedConstants.isDedicated);
atKey.sharedWith = jsonEncode(allAtsignList);
await SyncSecondary().callSyncSecondary(
SyncOperation.notifyAll,
atKey: atKey,
notification: eventData,
operation: OperationEnum.update,
isDedicated: MixedConstants.isDedicated,
);
EventKeyStreamService()
.mapUpdatedEventDataToWidget(eventNotificationModel!);
/// Dont need to sync here as notifyAll is called
if (onEventSaved != null) {
onEventSaved!(eventNotificationModel);
}
return result;
} catch (e) {
return e;
}
}