toBigInt method

BigInt toBigInt()

Returns this Rat as a BigInt.

Throws if this Rat is not an integer.

Implementation

BigInt toBigInt() {
  if (isInteger) {
    return truncate();
  }
  throw StateError(
    'Fraction $this is not an integer, to truncate use .truncate()',
  );
}