avoid-banned-types
added in: 1.4.0
warning
Configure types that you want to ban.
⚙️ Config example
dart_code_metrics:
...
rules:
...
- avoid-banned-types:
entries:
- paths: ["some/folder/.*\.dart", "another/folder/.*\.dart"]
deny: ["SomeType"]
message: "Do not use SomeType here."
- paths: ["core/.*\.dart"]
deny: ["CounterBloc"]
message: 'State management should be not used inside "core" folder.'
Example
❌ Bad:
void function(SomeType someParam) { // LINT
// ...
}
if (value case SomeType(: final field)) { // LINT
// ..
}
✅ Good:
void function(SomeOtherType someParam) {
// ...
}
if (value case SomeOtherType(: final field)) {
// ..
}