Skip to main content

avoid-future-ignore

Warns when the result of any Future is ignored by calling .ignore().

Calling .ignore() on a Future not only ignores the result, but also suppresses any exception from that Future which can lead to such exceptions not being logged or ever noticed.

In cases where .ignore() is correct and expected, consider adding a comment to provide all necessary context for the future reader.

Example

❌ Bad:

void main(Future myFuture) {
// LINT: Calling '.ignore() completely ignores the result of this future even if there is an exception.
// Try using try/catch, 'unawaited()' or adding a comment.
myFuture.ignore();
}

✅ Good:

void main(Future myFuture) {
unawaited(myFuture);

// can be safely ignored due to ...
myFuture.ignore();
}

Additional Resources