getNumByValueDouble static method
The parameter fractionDigits
must be an integer satisfying: 0 <= fractionDigits <= 20
.
Implementation
static num? getNumByValueDouble(double? value, int fractionDigits) {
if (value == null) return null;
String valueStr = value.toStringAsFixed(fractionDigits);
return fractionDigits == 0
? int.tryParse(valueStr)
: double.tryParse(valueStr);
}