EtherAmount.fromDouble constructor

EtherAmount.fromDouble(
  1. EtherUnit unit,
  2. double amount
)

Constructs an amount of Ether by a unit and its amount.

Implementation

factory EtherAmount.fromDouble(EtherUnit unit, double amount) {
  final wei = Decimal.parse(_factors[unit]!.toString()) *
      Decimal.parse(amount.toString());
  return EtherAmount.inWei(wei.toBigInt());
}