discarded_futures generates warnings on waitFor #58852
Labels
devexp-linter
Issues with the analyzer's support for the linter package
legacy-area-analyzer
Use area-devexp instead.
I'm the deveveloper of DCli which is an SDK for developing dart console apps.
https://onepub.dev/packages/dcli
DCli is a heavy user of waitFor (although we always us it wrapped in our own function waitForEx).
The new lint discarded_futures (which I'm very pleased to see has been released in 2.18) is however causing some problems in DCli code.
The purpose of the waitFor and waitForEx functions is to convert an async all to a sync call.
T waitFor(Future future, {Duration? timeout}) ;
T waitForEx(Future future)
Globally disabling the future isn't acceptable as it is a critical lint in CLI programming.
A forgotten await can result in you accidentally deleting the entire contents of your hard drive.
Is there some way to disable the lint at the declaration site rather than at each call site?
e.g.
rather than:
The text was updated successfully, but these errors were encountered: