equalsInt method

  1. @override
bool equalsInt(
  1. int n
)
override

Returns true if n is equals to this number.

Implementation

@override
bool equalsInt(int n) {
  if (precision == 0) {
    return _n.equalsInt(n);
  } else {
    if (isDecimalPartZero) {
      var n1Dec = compactedPrecision;
      assert(n1Dec.precision == 0);
      var n1 = n1Dec.toDynamicInt();
      return n1.isSafeInteger
          ? n1.toInt() == n
          : n1.toBigInt() == BigInt.from(n);
    } else {
      return false;
    }
  }
}