toPlusText method
Example:
String number = null.toPlusText();
print(number); // Output: 0
number = 15.toPlusText();
print(number); // Output: 15
number = -15.05.toPlusText();
print(number); // Output: +15.05
Implementation
String toPlusText([
String sign = "+",
]) {
num x = this ?? 0;
if (x < 0) {
x = x * -1;
return "$sign$x";
}
return "$x";
}