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;
|
PlatformFile? file;
|
||||||
|
|
||||||
String calculateDistance() {
|
String calculateDistance() {
|
||||||
double distanceInKm = MIHLocationAPI().getDistanceInMeaters(
|
try {
|
||||||
widget.myLocation!, widget.business.gps_location) /
|
double distanceInKm = MIHLocationAPI().getDistanceInMeaters(
|
||||||
1000;
|
widget.myLocation!, widget.business.gps_location) /
|
||||||
return "${distanceInKm.toStringAsFixed(2)} km";
|
1000;
|
||||||
|
return "${distanceInKm.toStringAsFixed(2)} km";
|
||||||
|
} catch (error) {
|
||||||
|
print(error);
|
||||||
|
return "*.** km";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue