findMostApplicable method
Rule?
findMostApplicable({
- required String path,
- PrecedenceStrategy comparisonMethod = PrecedenceStrategy.defaultStrategy,
Taking a path
, gets the Rule
s that pertain to it, and returns the
Rule
that has precedence over the other rules.
Implementation
Rule? findMostApplicable({
required String path,
PrecedenceStrategy comparisonMethod = PrecedenceStrategy.defaultStrategy,
}) {
final comparisonFunction = _ruleComparisonFunctions[comparisonMethod]!;
final applicableRules = findApplicable(path: path);
if (applicableRules.isEmpty) {
return null;
}
return applicableRules.reduce(comparisonFunction);
}