toNumAsSmartRound method

num toNumAsSmartRound({
  1. int maxPrecision = 2,
})

Converts to num after smart rounding

Implementation

num toNumAsSmartRound({int maxPrecision = 2}) {
  final rounded = toStringAsSmartRounded(maxPrecision: maxPrecision);
  return rounded.contains('.') ? double.parse(rounded) : int.parse(rounded);
}