From 7c7206f9ef7db9c3a61f10987b8e486496da7d42 Mon Sep 17 00:00:00 2001 From: Yasien Mac Mini Date: Tue, 15 Jul 2025 10:55:50 +0200 Subject: [PATCH] if location cal error, print default distance --- .../mih_business_profile_preview.dart | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Frontend/lib/mih_components/mih_package_components/mih_business_profile_preview.dart b/Frontend/lib/mih_components/mih_package_components/mih_business_profile_preview.dart index 8cba8112..7b1e8cd9 100644 --- a/Frontend/lib/mih_components/mih_package_components/mih_business_profile_preview.dart +++ b/Frontend/lib/mih_components/mih_package_components/mih_business_profile_preview.dart @@ -26,10 +26,15 @@ class _MihBusinessProfilePreviewState extends State { PlatformFile? file; String calculateDistance() { - double distanceInKm = MIHLocationAPI().getDistanceInMeaters( - widget.myLocation!, widget.business.gps_location) / - 1000; - return "${distanceInKm.toStringAsFixed(2)} km"; + try { + double distanceInKm = MIHLocationAPI().getDistanceInMeaters( + widget.myLocation!, widget.business.gps_location) / + 1000; + return "${distanceInKm.toStringAsFixed(2)} km"; + } catch (error) { + print(error); + return "*.** km"; + } } @override