getNumByValueDouble static method

num? getNumByValueDouble(
  1. double? value,
  2. int fractionDigits
)

fractionDigits == 0-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);
}