await_only_futures

Group: style

Maturity: stable

Linter v0.1.16

Since info is static, may be stale
corerecommendedflutterpedantic

View all Lint Rules

Using the Linter

AVOID using await on anything which is not a future.

Await is allowed on the types: Future<X>, FutureOr<X>, Future<X>?, FutureOr<X>? and dynamic.

Further, using await null is specifically allowed as a way to introduce a microtask delay.

BAD:

main() async {
  print(await 23);
}

GOOD:

main() async {
  await null; // If a delay is really intended.
  print(23);
}