actionOnEvent method

Future<bool> actionOnEvent(
  1. EventNotificationModel event,
  2. ATKEY_TYPE_ENUM keyType, {
  3. required bool isAccepted,
  4. required bool isSharing,
  5. required bool isExited,
  6. bool? isCancelled,
})

Processes any kind of update in an event and notifies creator/members

Implementation

Future<bool> actionOnEvent(
    EventNotificationModel event, ATKEY_TYPE_ENUM keyType,
    {required bool isAccepted,
    required bool isSharing,
    required bool isExited,
    bool? isCancelled}) async {
  var eventData = EventNotificationModel.fromJson(jsonDecode(
      EventNotificationModel.convertEventNotificationToJson(event)));

  try {
    if (isCancelled == true) {
      await updateEventMemberInfo(eventData,
          isAccepted: false, isExited: true, isSharing: false);
    } else {
      await updateEventMemberInfo(eventData,
          isAccepted: isAccepted, isExited: isExited, isSharing: isSharing);
    }

    notifyListeners();

    return true;
  } catch (e) {
    _logger.severe('error in updating event $e');
    return false;
  }
}