Notes: 01. Explore Keyboard Shortcuts
This updated version now shows on-screen shortcuts commands for both mac and windows.
Prerequisites include a Flutter installation setup with VS Code (Dart and Flutter Extension must be installed already). Non-Flutter developers could skip the Flutter installation as knowledge obtained here could be used for other development languages or frameworks. The sample project that comes with the course uses the Dart version before nullability was added to the language. Downloading and running the project would work correctly, but copying and pasting code may generate liniting errors if the code is not null-aware. This course is not dependent on the sample project so you can follow along with any project you have.
Visual Studio Code is an easy to use code editor that works great when developing Flutter apps. Using keyboard shortcuts is a common approach used by programmers during development. Visual Studio Code provides lots of keyboard shortcuts for most commands and gives us the option of adding more to suite our needs.
Utilizing this feature could help make your Flutter development a bit faster. Modifier keys are used to perform keyboard shortcuts and here are abbreviations and symbols for each modifier.
The sample app is a shortcuts app that shows the list of VSCode shortcuts for both mac and windows. You could refer to this anytime to help you memorize them. We would cover common shortcuts during this course and provide links to download the official cheat sheets from Visual Studio Code’s documentation.
F5
. This is a basic app that just shows the keyboard shortcuts for both mac and windows on different tabs. We would be using the project code for demonstration purposes in this course.
Shift + F5
to stop the app. Next, let’s change up VSCode.
Ctrl + B
to toggle the Side Bar. To toggle the Debug Console, press Ctrl + Shift + Y
. To toggle the Output, press Ctrl + Shift + U
.
For Problems tab, press Ctrl + Shift + M
. Finally for the Terminal, press Ctrl +
`
Ctrl + Shift + T
. Press Ctrl + W
to close the editor. If no editor is open and you execute that command, then it would close the window.
Ctrl + R
. This shows you a palette with a list of previously opened workspaces. You could select the one you wish to open. Holding down Ctrl
key while selecting opens the workspace in a new window.
Ctrl + Shift + P
to open it up. It contains a list of all the commands we could run inside of VSCode. And beside each command is the corresponding shortcut for it.
We could search for what we want do like “Toggle Minimap”. Selecting it toggles the minimap. And we’ll have to go to a file to see it in action. A minimap is just a bird’s eye view of the current file and we could scroll through it easily.
Ctr + Shift + P
and we could see the “Toggle Minimap” command up there because VSCode stores recently used commands. Now select it, and the minimap is hidden.
F1
key also opens the Command Palette.
We could search for Flutter and see Flutter related commands. Note that these commands were added by the Flutter VSCode extension. Let’s say you’re working on a large project with many files and folders and you want to quickly open a file and maybe only remember some part of the file name.
Ctrl + P
, then you type in the file name. Hit enter to select the file. Now you have it open in your editor.
Ctrl
then press K + S
. This opens up the “Keyboard Shortcuts” screen which shows all the keybindings and when they can be executed. You could search based on command name or keybinding. You could also change or add a shortcut by selecting the command and enter the new keybinding.