How to surround flutter widget in vscode


Asked by arkade on September 18, 2018 (source).

Just wondering if there is a shortcut or extension in visual studio code to surround a code block - or more specifically highlight the widget name and then surround that widgets children.

Often is the case where I have created, lets say a:

  padding: EdgeInsets.all(10.0),
  child: Container(

But then after some writing, i want to surround that Padding with something else, like a Column or Row. As is, I need to prefix the Padding with Row( child: and then scroll down and add the new ),` bracket

Is there not a way to just select the Padding and then tell vs code that I am going to prefix this so add the bracket for me?

Pretty sure I have seen this in action in IntelliJ


Question answered by Rémi R (source).


Vscode offer a few refactor options, including Wrap with Column:

enter image description here

Just right-click on a widget and press "Refactor".