always_declare_return_types

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.4)

Since info is static, may be stale
pedantic

View all Lint Rules

Using the Linter

DO declare method return types.

When declaring a method or function always specify a return type. Declaring return types for functions helps improve your codebase by allowing the analyzer to more adequately check your code for errors that could occur during runtime.

BAD:

main() { }

_bar() => _Foo();

class _Foo {
  _foo() => 42;
}

GOOD:

void main() { }

_Foo _bar() => _Foo();

class _Foo {
  int _foo() => 42;
}

typedef bool predicate(Object o);