Step by step instructions for how to create a new Flutter project in VSCode in windows
Step 1: Install VSCode
Download and Install VSCode from its officials links. https://code.visualstudio.com/download
Step 2: Install Flutter Extension
Install the Flutter extension for Visual Studio Code. You can do this by opening the Extension Marketplace in Visual Studio Code, searching for “Flutter”, and then clicking on “Install” for the Flutter extension.
Step 3: Install Java 11 SDK
Download and install Java 11 SDK from the below link. https://www.oracle.com/in/java/technologies/javase/jdk11-archive-downloads.html
- Create new variables under System variables.
name JAVA_HOME and values C:\Program Files\Java\jdk-11.0.12
JAVA_HOME=C:\Program Files\Java\jdk-11.0.12
2. Add %JAVA_HOME%\bin to PATH
%JAVA_HOME%\bin
Step 4: Install Android SDK Using Comand line tools
Download Android SDK using command line tools from its official link. https://developer.android.com/studio
- Create Folder in C:\Android\ Named as android-sdk.
- Extract files from downloaded zip file in path C:\Android\android-sdk\cmdline-tools\latest\. Note: Make sure the path must be same
- Create new variables under System variables.
ANDROID_HOME=C:\Android\android-sdk
ANDROID_SDK_ROOT=C:\Android\android-sdk
name ANDROID_HOME and values C:\Android\android-sdk,
name ANDROID_SDK_ROOT and values C:\Android\android-sdk.
4. Variable After added like this.
4. Add C:\Android\android-sdk\cmdline-tools\latest\bin to PATH
%ANDROID_HOME%\cmdline-tools\latest\bin
5. Update SDK Manager using cmd sdkmanager — update
sdkmanager --update
6. Download System Image, Platform, platform tools, emulator and build tools using following cmd
sdkmanager emulator platform-tools
sdkmanager "system-images;android-29;google_apis;x86"
sdkmanager "platforms;android-29"
sdkmanager "build-tools;29.0.2"
7. And final the following paths are added to PATH under system variables
Step 5: Install Flutter SDK
Download flutter latest version from its official links. https://docs.flutter.dev/get-started/install/windows
- Create Folder in C:\ Named as Android.
- Extract in downloaded zip file in path C:\Android\flutter
- Add C:\Android\flutter\bin to PATH
C:\Android\flutter\bin
4. Create Folder for Pubcache in Drive where the project are saved. D:\Program Data\.pubcache and added to PATH
D:\Program Data\.pubcache
Step 6: Check flutter is working
Using cmd flutter doctor -v
flutter doctor -v
Step 7: Create new flutter project
Create a new flutter project using cmd flutter create <projectname>
flutter create testpro
cd testpro
code .
code . to open folder in VSCode.
Step 8: Step to start emulator
Prerequisite for start emulator.
- Virtualization should be Enabled
3. Check the checkbox Windows Hypervisor platform in Windows 10 Home to install and enable Hyper-v.
4. To Create a new Android Virtual device and Launch device by open command palette by press keys Ctrl+Shift+P. and type select device.
and create Android emulator.
Step 9: Run Project Debug mode in VSCode
To start run flutter project in debug mode Select menu Run-> Start Debugging or Press F5 key.
Step 10: Run in Terminal
To open terminal by press key Ctrl+`. In the terminal type cmd flutter run to start run
flutter run
Step 11: Build for Production
To open terminal by press key Ctrl+`. In the terminal type cmd flutter build appbundle to get .abb file after build to deploy in playstore.
flutter build appbundle