remainder method

num? remainder(
  1. num other
)

The remainder of the truncating division of this by other.

The result r of this operation satisfies: this == (this ~/ other) * other + r. As a consequence, the remainder r has the same sign as the divider this.

The result is an int, as described by int.remainder, if both this and other are integers, otherwise the result is a double.

Example:

print(Obj(5).remainder(3)); // 2
print(Obj(-5).remainder(3)); // -2
print(Obj(5).remainder(-3)); // 2
print(Obj(-5).remainder(-3)); // -2

Implementation

num? remainder(num other) => value?.remainder(other);