applyConfig method
Applies configuration from a map.
Expected format:
rules:
- avoid-dynamic
- prefer-async-await:
severity: warning
exclude:
- test/**
Implementation
void applyConfig(Map<String, dynamic> config) {
final rules = config['rules'];
if (rules is! List) return;
for (final entry in rules) {
if (entry is String) {
// Simple enable: - avoid-dynamic
enable(entry);
} else if (entry is Map<String, dynamic>) {
// With options: - avoid-dynamic: { severity: warning }
for (final ruleEntry in entry.entries) {
final ruleId = ruleEntry.key;
final options = ruleEntry.value;
if (options is Map<String, dynamic>) {
_applyRuleOptions(ruleId, options);
} else if (options == true) {
enable(ruleId);
} else if (options == false) {
disable(ruleId);
}
}
}
}
}