updateEvent method

Future updateEvent(
  1. EventNotificationModel eventData,
  2. AtKey key
)

Implementation

Future<dynamic> updateEvent(
    EventNotificationModel eventData, AtKey key) async {
  try {
    var notification =
        EventNotificationModel.convertEventNotificationToJson(eventData);

    var result = await atClientInstance!
        .put(key, notification, isDedicated: MixedConstants.isDedicated);
    if (result is bool) {
      if (result) {
        if (MixedConstants.isDedicated) {
          await SyncSecondary()
              .callSyncSecondary(SyncOperation.syncSecondary);
        }
      }
      print('event acknowledged:$result');
      return result;
      // ignore: unnecessary_null_comparison
    } else if (result != null) {
      return result.toString();
    } else {
      return result;
    }
  } catch (e) {
    print('error in updating notification:$e');
    return false;
  }
}