formatDistance static method
Implementation
static String formatDistance(double distance) {
if (distance > 1000) {
distance = distance / 1000;
return (distance).toStringAsFixed(
distance.truncateToDouble() == distance ? 0 : 2) +
" KM";
} else {
return distance.floor().toString() + " Meter";
}
}