if location cal error, print default distance
This commit is contained in:
parent
c83f3b535b
commit
7c7206f9ef
1 changed files with 9 additions and 4 deletions
|
|
@ -26,10 +26,15 @@ class _MihBusinessProfilePreviewState extends State<MihBusinessProfilePreview> {
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue