covariant method

  1. @override
bool covariant(
  1. dynamic x
)
override

Assert that JavaScript's x is the proper type represented by this Type.

Implementation

@override
bool covariant(x) {
  final max = BigInt.from(2).pow(_bits);
  if (x is BigInt && x >= BigInt.zero) {
    return x < max;
  } else if (x is int && x >= 0) {
    final v = BigInt.from(x);
    return v < max;
  } else {
    return false;
  }
}