toBN function

BigInt toBN(
  1. dynamic number
)

Unify argument types by converting them to BigInt.

Implementation

BigInt toBN(dynamic number) {
  if (number is bool) {
    return number ? BigInt.one : BigInt.zero;
  } else if (number is int) {
    return BigInt.from(number);
  } else if (number is BigInt) {
    return number;
  } else {
    return BigInt.parse(number);
  }
}