Getting Started with CrossPlatform Mobile Application using Flutter (original) (raw)

Last Updated : 13 Mar, 2025

**Flutter is an **open-source mobile application development SDK created by **Google to develop **cross-platform mobile applications. Flutter makes it extremely easy and fast for even **novice programmers (computer programmers who are not experienced in any programming languages) to build high-quality and responsive native mobile apps. No prior app development experience is required! .This article will show you how to build a simple **Hello Flutter application and then run it on your own Android device!

Why use Flutter over native Java development?

Flutter has some unique features compared to native Java and other SDKs, such as:

Setting Up Flutter

**Step 1: Set up the Flutter SDK

  1. Download the latest SDK here: Flutter SDK Archive
  2. Extract the zip file and place the contained '**flutter' folder in the desired directory.

Install Location example

Here it is extracted the folder to the C:\ drive

Note: It is recommended to not install Flutter in a directory that, may require admin privileges, like 'C:\Program Files\'

**Step 2: Add Flutter to PATH: Though not required, it is recommended to set the **PATH variable to make Flutter easily accessible from anywhere on the system.

  1. Go to **Edit environment variables for your account in Control Panel. You can search for this setting in your search bar.
  2. Under **User variables, check if there is an entry called PATH:
    • If it exists, add a new path to 'flutter\bin'.
    • If the entry does not exist, create a new entry named **Path, and then add the full location to 'flutter\bin'.
  3. Reboot Windows after setting the PATH variable for it to work.

**Step 3: Set up Android Studio: Android Studio automatically downloads the development tools required for Flutter to work with Android.

  1. Download Android Studio here: Android Studio
  2. Start Android Studio and follow the SDK Manager wizard to download all the required build tools.

**Step 4: Set up Visual Studio Code: Visual Studio Code (or VS Code) is a light code editor that can be used in Flutter development. In this article, VS is used instead of Android Studio as it is lighter and has the minimal required features.

  1. Download and install VS Code: VS Code Download.
  2. To help in development, two VS Code extensions are recommended. Install the Flutter and Dart plugins from VS Code's Extension Tab. You can refer to it.**Setting Up VS Code Extensions for Flutter

VS Code Extensions to be installed

The VS Code Extensions to be installed

flutter doctor

  1. This will check everything required for Flutter to run and give a detailed report of any error it encounters.

Flutter Doctor

Upon successful setup, flutter doctor would show no errors

Creating an empty template project

flutter create project_name

For example, **the for a project named ****'helloflutter'** executing

flutter create helloflutter

create Project

The new project named helloflutter is created

Open in VS Code

Context menu to open folder in VS Code

First Run

Locating the main.dart file in the lib folder

Saying Hello Flutter!

Delete the MyHomePage Widget

class HelloFlutter extends StatelessWidget { const HelloFlutter({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Container(

);

} }

`

Add Class HelloFlutter

Added the new Stateless Widget HelloFlutter

class HelloFlutter extends StatelessWidget { const HelloFlutter({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return const Scaffold(

);

} }

`

class HelloFlutter extends StatelessWidget { const HelloFlutter({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Scaffold( body: Container(

  ),
);

} }

`

alignment: Alignment.center

class HelloFlutter extends StatelessWidget { const HelloFlutter({Key? key}) : super(key: key);

@override Widget build(BuildContext context) { return Scaffold( body: Container( alignment: Alignment.center, child: const Text('Hello Flutter!'), ), ); } }

`

Change Home Call

Changing the home property to call the Widget we made

Running the app

Running the App

Running the HelloFlutter App

Device Name

The device name will be shown here

  1. If you would like to set up an emulator instead, see: Set up the Android emulator. The emulated device would also show up here similarly.
  2. Open the integrated **terminal by pressing the key combination **[CTRL + `] (Control key + backtick).
  3. Run the command:

flutter run

Flutter Compile

Executing 'flutter run' and compilation of the default app

Running the app

Running the App