Tutorials

How to Get Started with Flutter – A Beginner’s Guide

Getting started with Flutter

Flutter has gained traction since its introduction in December 2018, and it is quickly becoming a popular choice for many professional mobile developers all over the world. Today, most Android and iOS developers think this is a speedier and more promising option than previous cross-platform frameworks.

To get started with Flutter, follow the steps below.

System Prerequisites

To install and execute Flutter, the following essential prerequisites must be met:

1. Windows 7 SP1 or later as the operating system (64-bit)

2. Disk space: 400 MB (does not include IDE/tool disc space).

3. Tools: The availability of these tools is critical for Flutter.

Windows PowerShell 5.0 or later is required (pre-installed Windows 10) Git for Windows 2. x can be accessed via the Windows command line by selecting the Use Git option.

If you already have Git for Windows installed, make sure you run git commands from the command line or PowerShell.

SDK for Flutter

To obtain the most recent stable version of the Flutter SDK, download the installation package.

Extract the zip file and place the flutter it contains in the Flutter SDK’s installation directory (for example, C: \ src \ flutter; do not install Flutter in a directory like C: \ Program Files\, which requires elevated privileges).

Steps 1 and 2 can be skipped if you do not want to install the corrected version. Instead, grab the source code from the Flutter repository on GitHub and, if necessary, change the tags. As an example:

C:\src>git clone https://github.com/flutter/flutter.git -b stable

You may now run Flutter commands in the Flutter Console!

Just Update your Path.

If you want to run Flutter commands from a standard Windows terminal, add Flutter to the PATH environment variable like follows:

  1. Enter “env” in the start search bar and then click “Edit environment variables for your account.”
  2. Examine the User variables section for the presence of a Path: entry.
  3. If the record already exists, add the whole route to the flutter bin using; as a separator from the existing data.
  4. If the record does not already exist, establish a new custom variable called Path that contains the complete path to the flutter bin value.
  5. It is important to note that in order for these changes to take effect, you must close and reopen all existing console windows.

Run flutter doctor

In the console window with the Flutter directory in the path, run the following command to see if there are platform dependencies required to complete the installation:

C:\src\flutter>flutter doctor

This command checks your environment and displays a report on the status of your Flutter installation. Carefully check the output for other software that you may need to install or other tasks that need to be completed.

For example:

[-] Android toolchain - develop for Android devices

• Android SDK at D:\Android\sdk                                                                                                                                ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ

• Try re-installing or updating your Android SDK,                                                                                                    visit https://flutter.dev/setup/#android-setup for detailed instructions.

The following sections describe how to complete these tasks and complete the installation process. After you have installed the missing dependencies, you can run the flutter doctor command again to make sure everything is configured correctly.

Configuration of Android

To obtain Android platform dependencies, Flutter requires a complete Android Studio installation. You can, however, write your Flutter apps in multiple editors.

Download and install Android Studio.
Install Android Studio after you’ve downloaded it.
Start Android Studio and go through the “Android Studio Setup Wizard.” This is where you install the most recent versions of the Android SDK, command-line tools, and build tools that Flutter requires while working on Android.

Set up your Android device

To launch and test the Flutter app on an Android device, you’ll need a device that runs Android 4.1 (API level 16) or higher. On your device, enable developer options and USB debugging. The Android documentation contains detailed instructions.

  1. Install the Google USB Driver if you’re using Windows.
  2. Connect your phone to your computer via a USB cord. If a request arrives on your device, allow your computer to access it.
  3. Run the flutter devices command in the terminal to ensure that Flutter recognizes the connected Android device. Flutter uses the version of the Android SDK that your ADB tool is built on by default. You must set the ANDROID HOME environment variable for this installation location if you want Flutter to use a different Android SDK installation.

Set up the Android emulator

Follow these steps to get ready to launch and test the Flutter app on the Android emulator:

  1. On your computer, enable virtual machine acceleration.
  2. Select Create Virtual Device from the Android Studio > Tools > Android > AVD Manager menu.
  3. Click Next after selecting the device description.
  4. Click Next after selecting one or more system images for the Android versions you want to imitate. It is best to use x86 or x86 64 images.
  5. Select Hardware-GLES 2.0 in the Emulated performance section to enable hardware acceleration.
  6. Check that the AVD setting is correct, and then click Done.
  7. On the toolbar of the Android virtual device Manager, select Run. The emulator starts and displays the default canvas for the OS version and device you’ve chosen.

Configuration of the Web

The beta Flutter channel provides early support for developing web applications.


.

You may also like...