double_extensions.dart 215 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 import 'dart:math'; extension Precision on double { double toPrecision(int fractionDigits) { var mod = pow(10, fractionDigits.toDouble()).toDouble(); return ((this * mod).round().toDouble() / mod); } }