BeforeRule constructor

const BeforeRule(
  1. String before,
  2. String after
)

Represents a reordering rule for property sources that ensures one source appears before another within a list of PropertySources.

This class is typically used with a property source container, such as MutablePropertySources, to dynamically reorder sources according to user-defined precedence rules.

Usage

final rule = BeforeRule('env', 'defaults');
final reordered = rule.apply(sourcesList);

In the example above:

  • The source named 'env' will be moved to appear before the source named 'defaults'.
  • If either source is not found, the original order is preserved.

Creates a new rule specifying that before must appear prior to after. Both before and after must be non-null strings corresponding to existing property source names.

Implementation

const BeforeRule(this.before, this.after);