getEtherValue property

double getEtherValue

Takes Ethereum BigDecimal value in String and convert it

Implementation

double get getEtherValue {
  final weiBigInt = BigInt.parse(this);
// Ether has 18 decimals
  final factor = BigInt.from(10).pow(18);
// 1 ether is 10^18 wei
  final value = weiBigInt ~/ factor;
  final remainder = weiBigInt.remainder(factor);
  return value.toInt() + (remainder.toInt() / factor.toInt());
}