compareTo method

  1. @override
int compareTo(
  1. covariant Phone other
)
override

The order of the comparisons is:

  1. countryCode
  2. local
  3. label

Implementation

@override
int compareTo(covariant Phone other) {
  // 1º comparison
  final int comparison1 = countryCode.compareTo(other.countryCode);
  if (comparison1 != 0) return comparison1;

  // 2º comparison
  final int comparison2 = local.compareTo(other.local);
  if (comparison2 != 0) return comparison2;

  // Last comparison
  final int comparison3 = label.compareTo(other.label);
  return comparison3;
}