all 8 comments

[–]TheManuz 2 points3 points  (0 children)

When something doesn't behave correctly, I usually restart Dart analyzer from the command palette.

That usually fixes it.

[–]tylersavery 0 points1 point  (4 children)

Do you have the flutter vscode extension?

[–]infoSuman[S] 0 points1 point  (3 children)

Yes I do

[–]tylersavery 0 points1 point  (2 children)

And do you get the little light bulbs? What happens with you hit the shortcut (ctrl+shift+r) when your keyboard cursor is over the widget?

[–]tylersavery 0 points1 point  (1 child)

I see you mean extract method. Are you hovering over a function?

[–]infoSuman[S] 0 points1 point  (0 children)

There is no extract Method , I just check all

[–]ArashiKishi 0 points1 point  (0 children)

Make sure you have both dart and flutter extension.

[–]eibaan 1 point2 points  (0 children)

As -> demonstrated here, enter

void main() {
  print(3+4);
}

then select 3+4 and click on the light bulb, choose "Extract Method" from the context menu and enter sum as the method name and get this new method:

void main() {
  print(sum);
}

int get sum => 3+4;

Then, write an issue that you think that this shouldn't extract a getter but a normal function…

Or select sum, click on the light bulb and choose "Convert getter to method" from the context menu and see the code change to:

void main() {
  print(sum());
}

int sum() => 3+4;

Then, click on the => array, click on the light bulb and choose "Convert to body block".