clearSelectedGroupContacts method

void clearSelectedGroupContacts({
  1. required BuildContext context,
  2. Function? onYesTap,
})

Will show a dialog box, if yes is pressed, will clear the selectedGroupContacts

Implementation

void clearSelectedGroupContacts({required BuildContext context, Function? onYesTap}) {
  if (selectedGroupContacts.isNotEmpty) {
    shownConfirmationDialog(context, 'Selected contacts will not be added , confirm?', () {
      selectedGroupContacts = [];
      selectedContactsSink.add(selectedGroupContacts); // to update the UI

      if (onYesTap != null) {
        onYesTap();
      }
    });
  } else {
    if (onYesTap != null) {
      onYesTap();
    }
  }
}