# doCompare method

1. @protected

int doCompare(

1. Object? o1,
2. Object? o2, [
3. OrderSourceProvider? provider

])

Internal comparison implementation that handles the core ordering logic.

This protected method implements the actual precedence rules without the source provider wrapper. It's used internally and can be overridden by subclasses for custom ordering behavior.

### Parameters:

- `o1`: The first object to compare
- `o2`: The second object to compare
- `provider`: Optional order source provider for indirect order resolution

### Returns:

The comparison result following the standard precedence rules

### Implementation Details:

    // PriorityOrdered takes absolute precedence
    if (o1 is PriorityOrdered && o2 is! PriorityOrdered) return -1;
    if (o2 is PriorityOrdered && o1 is! PriorityOrdered) return 1;

    // Then compare by order value
    final order1 = getOrder(o1, provider);
    final order2 = getOrder(o2, provider);
    return order1.compareTo(order2);

## Implementation

    @protected
    int doCompare(Object? o1, Object? o2, [OrderSourceProvider? provider]) {
      final p1 = o1 is PriorityOrdered;
      final p2 = o2 is PriorityOrdered;

      if (p1 && !p2) return -1;
      if (p2 && !p1) return 1;

      final i1 = getOrder(o1, provider);
      final i2 = getOrder(o2, provider);
      return i1.compareTo(i2);
    }