Flutter Visual Studio Code



Dart Code adds a number of commands to the command palette (Ctrl+Shift+P or Cmd+Shift+P).

Setting up Flutter and Visual Studio Code In Windows. Detailed video with all the proper steps to setup Flutter and to create a proper working environment fo. VS Code is a lightweight editor with Flutter app execution and debug support. VS Code, latest stable version; Install the Flutter and Dart plugins. Invoke View Command Palette. Type “install”, and select Extensions: Install Extensions. Type “flutter” in the extensions search field, select Flutter in the list,. If you’re debugging Flutter applications, you should also install the Flutter extension. Start an application to debug Start a debug session for your application by opening the root folder of your project (the one containing pubspec.yaml ) in VS Code and clicking Run Start Debugging ( F5 ). 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 pressing F5. Flutter: Run Flutter Doctor. This commands runs flutter doctor and shows the results in.

Adding Key Bindings for Commands

For information on key bindings, including how to add your own, see Key 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 using stagehand. 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 the dart.sdkPaths setting then this command will allow you to quickly switch between Dart SDKs. See Quickly Switching Between SDK Versions for more info.

Dart: Go to Super Class/Method

This command goes to the super 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 map lib/foo.dart to test/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 the Run or Debug 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 all recommended settings to your VS Code user settings for the Dart language.

Pub: Get Packages

This command fetches Pub packages listed in your pubspec.yaml and their dependencies for the current project. If invoked in a Flutter project this command will instead run Flutter: Get Packages.

For more information on using packages see the Dart website.

Pub: Upgrade Packages

This command upgrades Pub packages to the latest version allowed by the constraints in your pubspec.yaml for the current project. If invoked in a Flutter project this command will instead run Flutter: Upgrade Packages.

For more information on using packages see 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 the Get 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 the Add 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 the Developing 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 the Developing 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 pressing F5.

Flutter: Run Flutter Doctor

This commands runs flutter doctor and shows the results in the Output pane.

For more information on using packages see the Flutter website.

Flutter: Clean Project

This commands runs flutter 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. See Quickly Switching Between Flutter Devices for more info.

Flutter Visual Studio Code Run Emulator

Flutter: Change SDK

If you have configured the dart.flutterSdkPaths setting then this command will allow you to quick switch between Flutter SDKs. See Quickly Switching Between SDK Versions for more info.

Flutter: Get Packages

This command fetches Flutter packages listed in your pubspec.yaml and their dependencies for the current project. If invoked in a standard Dart project this command will instead run Pub: Get Packages.

For more information on using packages see the Flutter website.

Studio

Flutter: Upgrade Packages

Flutter Visual Studio Code Hot Reload

This command upgrades Flutter packages to the latest version allowed by the constraints in your pubspec.yaml for the current project. If invoked in a standard Dart project this command will instead run Pub: Upgrade Packages.

Flutter: Save Screenshot

This commands runs flutter screenshot to take a screenshot of the app running in the current debug session. Note: this command will not be available in the command palette unless there is a active debug session.

In this Flutter tutorial, I will teach you how to create a new Flutter project in the Visual Studio Code.

There are many IDEs to develop mobile applications but I recommend you choose anyone from below.

  • Visual Studio Code
  • Android Studio

The reason for recommending these two IDEs is their high performance and rich functionality.

This Flutter tutorial teaches you how to create a new Flutter project using Visual Studio Code.

Create A New Flutter Project In Visual Studio Code

To download and install the Visual Studio Code check the link

After you have successfully installed the Visual Studio Code into your computer. Now follow the steps as mentioned below.

  1. Open the Visual Studio Code.
  2. On the left sidebar locate option number 4 which is named as extensions. Click on it.
  3. In the search bar, you have to download three extensions. Flutter, Dart and Material Icon Theme.
  4. Another extension name is “Awesome Flutter Snippets” that you should download and install as well.

After you have done all the above steps now you are ready to create your new Flutter project in Visual Studio Code.

Now I will teach you how to create your Flutter project in VS Code.

  1. Click on the View tab in the menu bar and select Command Palette. Shortcut Ctrl + Shift + p.
  2. Now type Flutter you will see many different options.
  3. Select the option as Flutter: New Project. Give your project any valid name just as MyApp and press enter.
  4. Choose the parent directory where you want your app to be stored in your machine.
  5. Now, wait for a few moments to the VS Code to create your new Flutter project with all the default files and codes.
  6. The file in which you work most of the time is the main.dart file.

Note:When you create a new Flutter application your IDE requires you to enter a company domain name in reverse order. Reverse order use to maintain the uniqueness of your app on the Google App Store. This company domain name can’t change once it is set.

How To Run Your New Flutter App In VS Code

To run your newly created Flutter project follow the steps below.

On your VS Code and locate the status bar with blue color at the very bottom.

After selecting your emulator to run your app open your main.dart file in the lib folder.

Click on the Debug -> Start Debugging or press F5.

Your app will be launch after a few moments.

The the debugging is complete your app will look like this.

Hot Reload In Flutter Flutter

Hot Reload is a great feature of Flutter. It makes the development cycle much faster. With Hot Reload if you make any changes in your code you can see the results almost instantly.

Let’s have a look at Hot Reload.

Change the piece of string

Flutter Visual Studio Code Extensions

with this one

Flutter With Visual Studio

now save your code and you can see the changes in not time on your simulator or device.

Install Flutter Visual Studio Code

Congratulations! Now you are ready to create and run your Flutter Application in the Visual Studio Code without any error.