doubleStringWithoutTrailingZeros function
Given a number string this will display decimals just if it contains them For example 0.012 => 0.012 3.2 => 3.2 2.0 => 2
Implementation
String doubleStringWithoutTrailingZeros(String? doubleString) {
return (doubleString ?? "0.00").split(".").reduce((value, element) {
return "$value${double.parse(element) > 0 ? ".$element" : ""}";
});
}