from static method

BigInt from(
  1. Object value
)

Creates a BigInt from an existing BigInt or int value.

final BigInt value0 = BigIntExtension.normalize(BigInt.zero);
print(value0); // 0

final BigInt value1 = BigIntExtension.normalize(1);
print(value1); // 1

final BigInt value2 = BigIntExtension.normalize(2.9);
print(value2); // 2

Implementation

static BigInt from(final Object value) {
  assert(value is BigInt || value is String || value is num);
  if (value is BigInt) return value;
  return value is String ? BigInt.parse(value) : BigInt.from(value as num);
}