sendShareLocationToGroup method

Future<void> sendShareLocationToGroup(
  1. List<AtContact> selectedContacts, {
  2. int? minutes,
})

Sends location to selectedContacts for minutes.

Implementation

Future<void> sendShareLocationToGroup(List<AtContact> selectedContacts,
    {int? minutes}) async {
  await Future.forEach(selectedContacts, (AtContact selectedContact) async {
    var _state = await sendShareLocationEvent(selectedContact.atSign!, false,
        minutes: minutes);
    if (_state == true) {
      CustomToast().show(
          'Share Location Request sent to ${selectedContact.atSign!}',
          AtLocationNotificationListener().navKey.currentContext!,
          isSuccess: true);
    } else if (_state == false) {
      CustomToast().show(
          'Something went wrong for ${selectedContact.atSign!}',
          AtLocationNotificationListener().navKey.currentContext!,
          isError: true);
    }
  });
}