PriorityOrdered class abstract
A special marker interface for Ordered objects that should be given priority over other Ordered objects during sorting or processing.
This is typically used in systems where certain components (e.g., filters, interceptors, processors) must be initialized or invoked before others, even if they all implement Ordered.
βοΈ Priority Semantics
- PriorityOrdered pods are always sorted and processed before regular Ordered pods.
- Within each group (priority vs non-priority), ordering is still determined
by the
order
value.
π Example
class CoreFilter implements PriorityOrdered {
@override
int get order => 0;
}
class CustomFilter implements Ordered {
@override
int get order => 0;
}
final filters = [CustomFilter(), CoreFilter()];
filters.sort((a, b) {
final aPriority = a is PriorityOrdered ? -1 : 0;
final bPriority = b is PriorityOrdered ? -1 : 0;
return aPriority.compareTo(bPriority) != 0
? aPriority.compareTo(bPriority)
: a.order.compareTo(b.order);
});
- Implemented types
Constructors
- PriorityOrdered()
-
A special marker interface for Ordered objects that should be given
priority over other Ordered objects during sorting or processing.
const
Properties
- hashCode β int
-
The hash code for this object.
no setterinherited
- runtimeType β Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getOrder(
) β int -
A contract for objects that are assigned an order or precedence value.
inherited
-
noSuchMethod(
Invocation invocation) β dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) β String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) β bool -
The equality operator.
inherited