apply method
Applies this ordering rule to the provided list of `PropertySource`s.
Implementations must treat sources as immutable input and return a
new list representing the reordered sequence. The returned list may:
- preserve the original order,
- apply custom sorting algorithms,
- enforce precedence or override relationships,
- remove or merge duplicates,
- or otherwise reorganize the collection.
Parameters
- sources – The list of property sources to be ordered.
Returns
A newly constructed list representing the result of applying this rule.
Important
This method must never modify the original sources list.
Implementation
@override
List<PropertySource> apply(List<PropertySource> sources) {
return sources.toList()
..sort((a, b) {
final pa = priorities[a.getName()] ?? 1000;
final pb = priorities[b.getName()] ?? 1000;
return pa.compareTo(pb);
});
}