Commands
Dart Code adds a number of commands to the command palette (Ctrl+Shift+P orCmd+Shift+P).
- Adding Key Bindings for Commands
- Dart: Capture Logs
- Dart: Complete Statement
- Dart: New Project
- Dart: Change SDK
- Dart: Go to Super Class/Method
- Dart: Go to Test/Implementation File
- Dart: Show Type Hierarchy
- Dart: Rerun Last Debug Session
- Dart: Run Test At Cursor / Debug Test At Cursor
- Dart: Sort Members
- Dart: Write Recommended Settings
- Pub: Get Packages
- Pub: Upgrade Packages
- Flutter: New Application Project
- Flutter: New Module Project
- Flutter: New Package Project
- Flutter: New Plugin Project
- Flutter: Open Widget Sample
- Flutter: Run Flutter Doctor
- Flutter: Clean Project
- Flutter: Select Device
- Flutter: Change SDK
- Flutter: Get Packages
- Flutter: Upgrade Packages
- Flutter: Save Screenshot
Adding Key Bindings for Commands
For information on key bindings, including how to add your own, seeKey Bindings
Dart: Capture Logs
This command simplifies capturing logs for diagnosing issues. See the/docs/logging/ page for more info.
Dart: Complete Statement
This command will attempt to finish the current line you’re editing by adding things like closing brackets and semicolons before moving the cursor to the next line.
Dart: New Project
This command simplifies creation of new Dart projects by usingstagehand. You will be asked to select a project type, enter a name for your project and pick a folder to create it in. The folder will be created and opened and all required files created automatically. A notification will appear once the creation process is complete and your project is ready to run.
Dart: Change SDK
If you have configured thedart.sdkPaths setting then this command will allow you to quickly switch between Dart SDKs. SeeQuickly Switching Between SDK Versions for more info.
Dart: Go to Super Class/Method
This command goes to thesuper implementation of the method or class under the caret.
Dart: Go to Test/Implementation File
This command jumps between a file and its corresponding test file in the editor. It will maplib/foo.dart totest/foo_test.dart and back. The command is only available when the current file can be mapped and the target file exists.
Dart: Show Type Hierarchy
This command displays the hierarchy for the current types in a pick list.
Dart: Rerun Last Debug Session
This command will re-run the last Dart debug session that has run. This can be useful if you ran a specific test from the CodeLens links or test tree and want to quickly re-run it without navigating back there.
Dart: Run Test At Cursor / Debug Test At Cursor
If the cursor is within a test method, these commands will execute the test (the same as clicking theRun orDebug CodeLens link).
Dart: Sort Members
This command sort all of the directives, unit and class members in the current Dart file.
Dart: Write Recommended Settings
This command writes allrecommended settings to your VS Code user settings for the Dart language.
Pub: Get Packages
This command fetches Pub packages listed in yourpubspec.yaml and their dependencies for the current project. If invoked in a Flutter project this command will instead runFlutter: Get Packages.
For more information on using packagessee the Dart website.
Pub: Upgrade Packages
This command upgrades Pub packages to the latest version allowed by the constraints in yourpubspec.yaml for the current project. If invoked in a Flutter project this command will instead runFlutter: Upgrade Packages.
For more information on using packagessee the Dart website.
Flutter: New Application Project
This command simplifies the creation of new Flutter application projects. You will be asked for a name for your project and a folder to create it in. The folder will be created and opened automatically and all required files created automatically. A notification will appear once the creation process is complete and your project is ready to run.
For more information on getting started with your first app, see theGet Started: Test Drive section of the Flutter website.
Flutter: New Module Project
This command simplifies the creation of new Flutter module projects. You will be asked for a name for your project and a folder to create it in. The folder will be created and opened automatically and all required files created automatically. A notification will appear once the creation process is complete and your project is ready to run.
For more information on building a module to use in an existing iOS/Android app, see theAdd Flutter to existing app section of the Flutter website.
Flutter: New Package Project
This command simplifies the creation of new Flutter package projects. You will be asked for a name for your project and a folder to create it in. The folder will be created and opened automatically and all required files created automatically. A notification will appear once the creation process is complete and your project is ready to run.
For more information on getting started with your first package, see theDeveloping Packages: Introduction section of the Flutter website.
Flutter: New Plugin Project
This command simplifies the creation of new Flutter plugin projects. You will be asked for a name for your project and a folder to create it in. The folder will be created and opened automatically and all required files created automatically. A notification will appear once the creation process is complete and your project is ready to run.
For more information on getting started with your first plugin, see theDeveloping Packages: Plugins section of the Flutter website.
Flutter: Open Widget Sample
This commands provides easy access to all Flutter widget sample applications. You will be shown a list of all available samples, and selecting one will open the sample in VS Code ready for you to run by pressingF5.
Flutter: Run Flutter Doctor
This commands runsflutter doctor and shows the results in theOutput pane.
For more information on using packagessee the Flutter website.
Flutter: Clean Project
This commands runsflutter clean to remove any existing build output for the current project.
Flutter: Select Device
If you have multiple devices or simulators connected then this command will allow you to quickly switch between Dart SDKs. SeeQuickly Switching Between Flutter Devices for more info.
Flutter: Change SDK
If you have configured thedart.flutterSdkPaths setting then this command will allow you to quick switch between Flutter SDKs. SeeQuickly Switching Between SDK Versions for more info.
Flutter: Get Packages
This command fetches Flutter packages listed in yourpubspec.yaml and their dependencies for the current project. If invoked in a standard Dart project this command will instead runPub: Get Packages.
For more information on using packagessee the Flutter website.
Flutter: Upgrade Packages
This command upgrades Flutter packages to the latest version allowed by the constraints in yourpubspec.yaml for the current project. If invoked in a standard Dart project this command will instead runPub: Upgrade Packages.
Flutter: Save Screenshot
This commands runsflutter screenshot to take a screenshot of the app running in the current debug session.Note: this command willnot be available in the command palette unless there is a active debug session.