init method

dynamic init(
  1. bool isUpdate,
  2. EventNotificationModel? eventData
)

always called before creating or editing an event

Implementation

// ignore: always_declare_return_types
init(bool isUpdate, EventNotificationModel? eventData) {
  if (eventData != null) {
    EventService().eventNotificationModel = EventNotificationModel.fromJson(
        jsonDecode(EventNotificationModel.convertEventNotificationToJson(
            eventData)));
    createContactListFromGroupMembers();
    update();
  } else {
    eventNotificationModel = EventNotificationModel();
    eventNotificationModel!.venue = Venue();
    eventNotificationModel!.event = Event();
    eventNotificationModel!.group = AtGroup('');
    selectedContacts = [];
    selectedContactsAtSigns = [];
  }
  isEventUpdate = isUpdate;
  atClientManager = AtClientManager.getInstance();
  Future.delayed(const Duration(milliseconds: 50), () {
    eventSink.add(eventNotificationModel);
  });
}