Skip to main content

prefer-explicit-function-type

added in: 1.11.0
preset: recommended

Warns when a Function type does not specify the return type and arguments.

Example

❌ Bad:

class SomeWidget {
final Function onTap; // LINT

const SomeWidget(this.onTap);
}

✅ Good:

class SomeWidget {
final void Function() onTap;

const SomeWidget(this.onTap);
}