Skip to main content

avoid-unnecessary-call

has auto-fix
pro+

Warns when a .call() invocation is unnecessary and can be simplified.

Example

❌ Bad:

class SomeClass {
void call() {
...
}
}

final instance = SomeClass();
// LINT: This invocation is unnecessary and can be simplified. Try removing it.
instance.call();

✅ Good:

class SomeClass {
void call() {
...
}
}

final instance = SomeClass();
instance();