lcm method

int lcm(
  1. int other
)

Returns the least common multiple of this and other.

4.lcm(6) // 12

Implementation

int lcm(int other) {
  final a = toInt().abs();
  final b = other.abs();
  if (a == 0 || b == 0) return 0;
  return (a ~/ gcd(b)) * b;
}