evaluate static method

String evaluate(
  1. Map<String, Object?> facts, [
  2. DeviceTierConfig? config
])

The tier of the first rule that matches facts, else the config's fallback.

Implementation

static String evaluate(
  Map<String, Object?> facts, [
  DeviceTierConfig? config,
]) {
  final resolved = config ?? DeviceTierConfig.defaults;
  for (final rule in resolved.rules) {
    if (_matches(rule, facts)) return rule.tier;
  }
  return resolved.fallback;
}