toBigInt method

BigInt toBigInt(
  1. Object? value
)

Convert the specified object into a BigInt. Throws ConversionException if the value cannot be converted.

Implementation

BigInt toBigInt(Object? value) {
  if (value is BigInt) {
    return value;
  } else if (value is String) {
    BigInt? d = BigInt.tryParse(value);
    if (d == null) {
      throw ConversionException(
          "The value $value can't be converted to a BigInt");
    }
    return d;
  } else {
    throw ConversionException(
        "The value $value can't be converted to a BigInt");
  }
}