appendNewContact method
adds atSign
to allContacts
Implementation
appendNewContact(String atSign) {
try {
var _indexOfContact = ContactService().contactList.indexWhere((element) {
return ContactService().compareAtSign(element.atSign!, atSign);
});
if (_indexOfContact != -1) {
var _indexOfContactInGroup =
allContacts.indexWhere((element) => element!.contact != null && element.contact!.atSign == atSign);
if (_indexOfContactInGroup == -1) {
allContacts.add(GroupContactsModel(
contact: ContactService().contactList[_indexOfContact], contactType: ContactsType.CONTACT));
}
}
_allContactsStreamController.add(allContacts);
} catch (e) {
_allContactsStreamController.add([]);
}
}