compareTo method

  1. @override
int compareTo(
  1. dynamic other
)
override

Returns this.priority - other.priority if not the same Returns this.creationTime - other.creationTime if priorities the same Returns 0 if other is not a Task

Implementation

@override
int compareTo(other) {
  if (other is Task) {
    final diff = priority - other.priority;
    if (diff != 0) {
      return diff;
    }
    return creationTime.difference(other.creationTime).inMicroseconds;
  }
  return 0;
}