upsertContactsBasedOnId method

  1. @action
Future<int> upsertContactsBasedOnId(
  1. List<ContactWeebi> data
)

Implementation

@action
Future<int> upsertContactsBasedOnId(List<ContactWeebi> data) async {
  final twoLists = contacts.findDupsById(newList: data);
  if (twoLists.dups.isNotEmpty) {
    for (final h in twoLists.dups) {
      await updateContact(h);
    }
  }
  if (twoLists.noDups.isNotEmpty) {
    await createAllContacts(twoLists.noDups);
  }
  return twoLists.dups.length + twoLists.noDups.length;
}