blockUnblockContact method

Future<bool> blockUnblockContact({
  1. required AtContact contact,
  2. required bool blockAction,
})

blocks/unblocks contact based on boolean blockAction if blockAction is true , atContact will be blocked.

Implementation

Future<bool> blockUnblockContact(
    {required AtContact contact, required bool blockAction}) async {
  try {
    contact.blocked = blockAction;
    var res = await atContactImpl.update(contact);
    if (res) {
      await fetchBlockContactList();
      await fetchContacts();
      return res;
    } else {
      return false;
    }
  } catch (error) {
    print('error in unblock: $error');
    return false;
  }
}