remainder method

  1. @override
Number remainder(
  1. dynamic divisor
)
override

Returns the remainder of the truncating division of this Number by divisor. The result r of this operation satisfies: this == (this ~/ other) * other + r. As a consequence the remainder r has the same sign as the operator /(divisor).

Implementation

@override
Number remainder(dynamic divisor) {
  final div = divisor is num
      ? divisor
      : divisor is Number
          ? divisor.toDouble()
          : 0;
  final rem = value.remainder(div);
  if (rem is int) return Integer(rem);
  return Double(rem.toDouble());
}