avoid-unnecessary-call
preset: recommended
Warns when a .call()
invocation is unnecessary and can be simplified.
Example
❌ Bad:
class SomeClass {
void call() {
...
}
}
final instance = SomeClass();
instance.call(); // LINT: This invocation is unnecessary and can be simplified. Try removing it.
✅ Good:
class SomeClass {
void call() {
...
}
}
final instance = SomeClass();
instance();