invalid_await_not_required_annotation
The annotation 'awaitNotRequired' can only be applied to a Future-returning function, or a Future-typed field.
Description
#The analyzer produces this diagnostic when anything other than a Future
-returning function or a Future
-typed field or top-level variable is annotated with awaitNotRequired
.
Example
#The following code produces this diagnostic because the annotation is on a void
-returning function:
dart
import 'package:meta/meta.dart';
@awaitNotRequired
void f() {}
Common fixes
#Remove the annotation:
dart
void f() {}
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-05-08. View source or report an issue.