Int128.fromBigInt constructor

Int128.fromBigInt(
  1. BigInt value
)

Builds from an arbitrary signed BigInt, truncating to 128 bits like a wrapping cast. BigInt.toUnsigned gives the exact two's-complement bit pattern directly, so this is correct for any magnitude.

Implementation

factory Int128.fromBigInt(BigInt value) =>
    Int128._(Uint128.fromBigInt(value.toUnsigned(128)));