Azure in Mobile Apps - Setting Up Flutter Environment.
Published: 2021-01-18 11:13:01

## What is flutter environment?
This is where all the flutter magic is done. 
It entails IDEs and plugins necessary for flutter development.

## IDEs
IDEs are editors used to write code. 
IDEs that support flutter at the moment of writing this article are;
- Visual Studio Code
- Android Studio

We're going to discuss installation of flutter in both of these software.

Before diving into the software, let's get the necessary basic installation first.
We'll need to install flutter sdk.
Refer to the official flutter documentation for installation in various platforms here: https://flutter.dev/docs/get-started/install

## Visual Studio Code

### Install VS Code
VS Code is a lightweight editor with Flutter app execution and debug support.

VS Code, latest stable version: https://code.visualstudio.com/

### Install the Flutter and Dart plugins
1. Start VS Code.
2. Invoke View > Command Palette….
3. Type “install”, and select Extensions: Install Extensions.
4. Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin.

### Validate your setup with the Flutter Doctor
1. Invoke View > Command Palette….
2. Type “doctor”, and select the Flutter: Run Flutter Doctor.
3. Review the output in the OUTPUT pane for any issues. Make sure to select Flutter from the dropdown in the different Output Options.

## Android Studio

### Install Android Studio
1. Download and install Android Studio : https://developer.android.com/studio
2. Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android.

### Set up your Android device

To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 4.1 (API level 16) or higher.

1. Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation; https://developer.android.com/studio/debug/dev-options
2. Windows-only: Install the Google USB Driver.
3. Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
4. In the terminal, run the flutter devices command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where your adb tool is based. If you want Flutter to use a different installation of the Android SDK, you must set the ANDROID_SDK_ROOT environment variable to that installation directory.

### Set up the Android emulator
To prepare to run and test your Flutter app on the Android emulator, follow these steps:

1. Enable VM acceleration on your machine; https://developer.android.com/studio/run/emulator-acceleration
2. Launch Android Studio, click the AVD Manager icon, and select Create Virtual Device…
- In older versions of Android Studio, you should instead launch Android Studio > Tools > Android > AVD Manager and select Create Virtual Device…. (The Android submenu is only present when inside an Android project.)
- If you do not have a project open, you can choose Configure > AVD Manager and select Create Virtual Device…
3. Choose a device definition and select Next.
4. Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
5. Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.
6. Verify the AVD configuration is correct, and select Finish.

For details on the above steps, see Managing AVDs; https://developer.android.com/studio/run/managing-avds

7. In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.