addNewContactAndGroupMembers method

dynamic addNewContactAndGroupMembers(
  1. List<GroupContactsModel?> selectedList
)

adds new contacts and group members to the event notification model

Implementation

addNewContactAndGroupMembers(List<GroupContactsModel?> selectedList) {
  if (EventService().eventNotificationModel!.group!.members == null) {
    EventService().eventNotificationModel!.group!.members = {};
  }

  // ignore: avoid_function_literals_in_foreach_calls
  selectedList.forEach((element) {
    if (element!.contact != null) {
      var newContact = getGroupMemberContact(element.contact!);
      addContactToList(newContact);
    } else if (element.group != null) {
      // ignore: avoid_function_literals_in_foreach_calls
      element.group!.members!.forEach((groupMember) {
        var newContact = getGroupMemberContact(groupMember);

        addContactToList(newContact);
      });
    }
  });
}