compare method

Ordering<num> compare(
  1. num other
)

Implementation

Ordering<num> compare(num other) {
  final difference = this - other;

  if (difference > 0) {
    return Greater(difference);
  } else if (difference < 0) {
    return Less(-difference);
  } else {
    return const Equal();
  }
}