toEther static method
Unit conversion: wei -> ether
- bigInt has a pitfall: only x/y = double values are correct
Implementation
static double toEther({
required BigInt fromWei,
int decimals = 18, // conversion precision digits: default eth=18
}) {
/// Conversion unit: 10^x power
final unit = BigInt.from(10).pow(decimals);
/// Conversion:
return fromWei / unit;
}