toPrecision static method
Implementation
static String toPrecision(
double value, {
String? withSymbol,
int decimals = 4,
}) {
final parsed = value
.toStringAsPrecision(8)
.toDouble()
.toStringAsFixed(decimals);
if ((withSymbol ?? '').isNotEmpty) {
return '$parsed $withSymbol';
}
return parsed;
}