VSCode Dart Import Shortcut

SuperDeclarative picture SuperDeclarative · Feb 7, 2019 · Viewed 7.2k times · Source

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.

Answer

Alexandre Ardhuin picture Alexandre Ardhuin · Feb 7, 2019

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.