Extract method refactors widget with async callback incorrectly #4053
Labels
in editor
Relates to code editing or language features
in lsp/analysis server
Something to be fixed in the Dart analysis server
is bug
Milestone
Describe the bug
In a build function, when calling extract method on a widget such as a button with an asynchronous callback (e.g. async
onPressed
method), the newly created method itself is marked as anasync
function, which is incorrect (at least in all the cases that I've used it). While the callback is asynchronous, the function that is returning the widget should not be.To Reproduce
Steps to reproduce the behavior:
Place your cursor on
IconButton
, bring up the context menu, pressextract method
, and name the new function.The
IconButton
will have been replaced by your new method, but it has anawait
keyword before it that should not be there.Expected behavior
The new function is added in place of the
IconButton
without anawait
in front of the function call. The new function does not return aFuture<Widget>
but just aWidget
. The new method is not anasync
method.Please complete the following information:
The text was updated successfully, but these errors were encountered: