m3_lightmeter/lib/utils/to_string_signed.dart

20 lines
395 B
Dart
Raw Normal View History

extension SignedString on num {
String toStringSigned() {
if (this > 0) {
return "+${toString()}";
} else {
return toString();
}
}
}
2023-01-25 18:58:29 +00:00
extension SignedStringDouble on double {
String toStringSignedAsFixed(fractionDigits) {
if (this > 0) {
return "+${toStringAsFixed(fractionDigits)}";
} else {
return toStringAsFixed(fractionDigits);
}
}
}