6

Does VSCode and/or a plugin offer a keyboard shortcut to automatically add an import in a Dart file? In IntelliJ and Android Studio this effect is easily achieved with Opt+Enter.

SuperDeclarative
  • 1,609
  • 4
  • 18
  • 32

2 Answers2

23

If you try to organize imports you can use Alt+Shift+O.

If you have a Type not recognised in the current file, you can use Ctrl+. (macOS: Cmd+.) to open Quick Fixes and select the imports you need (the searched import are dependent to your pubspec file).

See the key bindings of the Dart extension.

Alexandre Ardhuin
  • 71,959
  • 15
  • 151
  • 132
1

Alternatively, you can use the following Vscode extensions to auto import dependencies:

https://marketplace.visualstudio.com/items?itemName=davidwoo.flutter-auto-import

FVVID
  • 155
  • 1
  • 9