m3_lightmeter/lib/utils/to_string_signed.dart
2023-11-01 11:33:18 +01:00

10 lines
298 B
Dart

/// Returns value in form -1 or + 1. The only exception - 0.
extension SignedStringDouble on double {
String toStringSignedAsFixed(int fractionDigits) {
if (this > 0) {
return "+${toStringAsFixed(fractionDigits)}";
} else {
return toStringAsFixed(fractionDigits);
}
}
}