18 lines
426 B
Dart
18 lines
426 B
Dart
class GeometryMeasureFormatter {
|
|
static String length(double meters) {
|
|
if (meters < 1000.0) {
|
|
return '${meters.toStringAsFixed(0)} m';
|
|
}
|
|
|
|
return '${(meters / 1000.0).toStringAsFixed(2)} km';
|
|
}
|
|
|
|
static String area(double squareMeters) {
|
|
if (squareMeters < 10000.0) {
|
|
return '${squareMeters.toStringAsFixed(0)} m²';
|
|
}
|
|
|
|
return '${(squareMeters / 10000.0).toStringAsFixed(2)} ha';
|
|
}
|
|
}
|