prefer_void_to_null

Group: errors

Maturity: stable

Linter v0.1.59

Since info is static, may be stale
recommendedflutter

View all Lint Rules

Using the Linter

DO NOT use the type Null where void would work.

BAD:

Null f() {}
Future<Null> f() {}
Stream<Null> f() {}
f(Null x) {}

GOOD:

void f() {}
Future<void> f() {}
Stream<void> f() {}
f(void x) {}

Some exceptions include formulating special function types:

Null Function(Null, Null);

and for making empty literals which are safe to pass into read-only locations for any type of map or list:

<Null>[];
<int, Null>{};