MobilApp/lib/core/geometry_measure_formatter.dart

18 lines
426 B
Dart
Raw Normal View History

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)}';
}
return '${(squareMeters / 10000.0).toStringAsFixed(2)} ha';
}
}