convertToBigInt method

BigInt convertToBigInt(
  1. num value
)

Implementation

BigInt convertToBigInt(num value) {
  if (value is int) {
    return BigInt.from(value) * BigInt.from(10).pow(18);
  } else if (value is double) {
    BigInt pres = BigInt.from(10).pow(18);
    return BigInt.from((value * pres.toInt()));
  } else {
    throw ArgumentError('Value must be an int or a double');
  }
}