onLocationClick method

dynamic onLocationClick()

Implementation

onLocationClick() async {
  if (!availableFeatures.value.isLocationAttachmentAvailable.checkNull()) {
    DialogUtils.showFeatureUnavailable();
    return;
  }
  if (await AppUtils.isNetConnected()) {
    var permission = await AppPermission.checkAndRequestPermissions(
        permissions: [Permission.location],
        permissionIcon: locationPinPermission,
        permissionContent: getTranslated("locationPermissionContent"),
        permissionPermanentlyDeniedContent:
            getTranslated("locationPermissionDeniedContent"));
    if (permission) {
      setOnGoingUserGone();
      NavUtils.toNamed(Routes.locationSent)?.then((value) {
        if (value != null) {
          value as LatLng;
          sendLocationMessage(profile, value.latitude, value.longitude);
        }
        setOnGoingUserAvail();
      });
    }
  } else {
    toToast(getTranslated("noInternetConnection"));
  }
}