Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up devices for Visual Studio Code for a Flutter emulator

I'd like to use Visual Studio Code as my editor for Flutter development, but I don't know how to get the emulator going. I've installed Visual Studio Code on Ubuntu 17.10 (Artful Aardvark).

I followed the first half of instructions as outlined on the Flutter: Get Started page (Create new app). Then I ran into trouble in the second half:

Run the app

  1. Make sure a target device is selected in the lower, right-hand corner of VS Code
  2. Press the F5 button on the keyboard, or invoke Debug>Start Debugging
  3. Wait for the app to launch
  4. If everything works, after the app has been built, you should see your starter app on your device or simulator:

The problem is that in that bottom right-hand corner is "No Devices."

How do I connect a device? I can't seem to find instructions anywhere.

like image 646
Charles Thomas Ingles Avatar asked Mar 14 '18 14:03

Charles Thomas Ingles


People also ask

How do I add emulators to VS code?

Step 1: Go to the Extensions button on VSCode and search for Android and iOS Emulator and install it. Note: Change the Emulator path windows address based on the location of the emulator file on your PC but make the Emulator path as default it would be given as default by the VSCode.


2 Answers

From version 2.13.0 of Dart Code, emulators can be launched directly from within Visual Studio Code, but this feature relies on support from the Flutter tools which means it will only show emulators when using a very recent Flutter SDK. Flutter’s master channel already has this change, but it may take a little longer to filter through to the development and beta channels.

I tested this feature, and it worked very well on Flutter version 0.5.6-pre.61 (master channel).

Enter image description here

like image 86
Saeed Zarinfam Avatar answered Oct 18 '22 09:10

Saeed Zarinfam


Do Ctrl + Shift + P

Then type Flutter:launch emulator

or

run this command in your Visual Studio Code terminal flutter emulators then see the result if you have installed any emulator it will show you. Then to run one of them, use flutter emulators --launch your_emulator_id in my case flutter emulators --launch Nexus 6 API 28

But if you haven't installed any emulator you can install one with flutter emulators --create [--name xyz], and then run your project flutter run inside the root directory of the project.

like image 33
art_cs Avatar answered Oct 18 '22 08:10

art_cs