formatDistance function
Implementation
String formatDistance(double distanceMetre, {String? suffix, String within1MetreText = "Right here"}){
final numberFormat = NumberFormat("#,###.#");
if (distanceMetre < 1000) {
if(distanceMetre <= 1){
return within1MetreText ?? "Right here";
}
return numberFormat.format(distanceMetre) + "m" + (suffix != null ? " $suffix" : "");
}
return numberFormat.format(distanceMetre/1000) + "km" + (suffix != null ? " $suffix" : "");
}