PriorityRule constructor

const PriorityRule(
  1. Map<String, int> priorities
)

A reordering rule for property sources based on explicit numeric priorities.

Each property source name can be assigned an integer priority.

  • Lower numbers indicate higher precedence.
  • Sources not listed in priorities default to a low priority (e.g., 1000) and appear later.

This rule is typically applied to a list of PropertySources to produce a deterministic ordering according to user-defined priorities.

Example

final rule = PriorityRule({'env': 1, 'defaults': 10});
final reordered = rule.apply(sourcesList);

In this example, 'env' will be moved before 'defaults' regardless of their original positions in the list.

Creates a new rule using the given priorities map. Every entry in the map represents a property source name and its desired precedence order.

Implementation

const PriorityRule(this.priorities);