ComparatorRule class

A property source ordering rule that sorts sources using a custom OrderComparator.

This rule allows flexible, user-defined sorting logic for PropertySource instances. The comparator defines how two sources are compared and determines their relative order.

Example

final comparator = MyCustomComparator();
final rule = ComparatorRule(comparator);
final reordered = rule.apply(sourcesList);

The reordered list will be sorted according to the logic implemented in comparator.

Implemented types

Constructors

ComparatorRule(OrderComparator comparator)
A property source ordering rule that sorts sources using a custom OrderComparator.
const

Properties

comparator OrderComparator
The comparator used to define custom ordering logic.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(List<PropertySource> sources) List<PropertySource>
Applies this ordering rule to the provided list of `PropertySource`s.
override
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