flutter app tutorial

How To Develop An Android App With Flutter SDK Using Dart Tutorial

In this tutorial, we will learn:

  • What is Flutter SDK?
  • How to use Dart programming language with Flutter.
  • How Flutter can be used for Android and iOS app development.
  • How to setup development environment for developing cross-platform Android and iOS apps using Flutter and Dart.
  • How to configure Flutter SDK with Android Studio.
  • How to add Dart dependencies in Flutter App in Android Studio.
  • We will Develop simple Android App in Android Studio using Flutter SDK and Dart programming language.
  • What is Hot Reload in Flutter?
  • Widgets in Flutter.

Introduction to Flutter SDK:

Flutter was first announced by Google at Google I/O 17 and Flutter beta 1 was released on Mobile World Congress (2017). And now Flutter Beta 3 is announced at Google I/O 18 which is ready to be used for production apps.

Flutter is a new open source cross-platform SDK by Google for developing native experience apps for Android and iOS platform.

Flutter uses Dart programming language for developing apps.

Flutter support Material Design components for Android and Cupertino for iOS, so if you design and develop your apps using Flutter SDK they will look and feel like native Android or iOS app.

Flutter SDK can be installed on Mac or Windows, and it has plugins for Android Studio, IntelliJ IDEA, Visual Studio.

You can access core features of any iOS or Android app using Flutter packages e.g. SQLite, Camera, JSON Parser, WebViews, and Images.

Flutter also supports Firebase API’s.

Many companies started using Flutter SDK like Alibaba.

Flutter SDK uses Dart programming language:

Why Flutter uses Dart programming language:

  • Dart is easy to learn and implement because it supports modern features of static and dynamic programming. Its syntax is similar to C# and Java.
  • Dart compiles into ARM and X86 (Native Code) which makes it eligible to be used for cross-platform development.
  • A developer can implement smooth scrolling and animations because Dart can execute at the rate of 60 frames per second.
  • Dart is appropriate to reactive programming, with help for a short-lived object, for example, UI Widgets through Dart’s quick object allotment and garbage collector. Dart support asynchronous programming through language features and APIs.

How to Install Flutter SDK:

  • We will install and run Flutter on Windows 10 machine.
  • We will install Flutter plugin in Android Studio and configure Flutter SDK with Android Studio.
Tools required for Flutter to be installed on windows:

Download Flutter SDK from this Flutter Download link.

Extract Zip file, open C:\Program Files and paste the extracted folder there.

Now open this folder and run the flutter_console.bat file.

After the Flutter is installed you will see below output.

Install flutter sdk windows 10
Installing Flutter SDK

If you type flutter doctor in above console.

Flutter will give you report like below.

flutter doctor
Run Flutter doctor

Adding Flutter path in Environment variables:

To be able to run Flutter from the command prompt or power shell You need to add Flutter SDK path in your system environment variables.

Go to Environment variables -> User Variables and add new variable in path.

Path value  :  (C:\Program Files\flutter_windows_v0.3.2-beta\flutter\bin)

Flutter environment variable
Adding Environment Variable for Flutter SDK

Now we have installed Flutter SDK on our windows machine, we will configure Flutter with Android Studio.

Configuring Flutter with Android Studio Tutorial:

Open Android Studio, go to plugins and search for Flutter and install it.

When you will click Install button, Android Studio will show you pop up that Flutter also needs Dart plugin.

Do you want to install Dart also, Click yes button.

Flutter Plugin for Android Studio
Installing Flutter Plugin

Restart Android Studio when prompted.

Now we are ready to create new Flutter Application in Android Studio.

Creating Flutter App in Android Studio:

Click on start new Flutter project in Android studio – > select Flutter Application and click Next.

How to Create Flutter App Android Studio
Create Flutter App Android Studio

Configuring Flutter SDK in Android Studio:

Android Studio needs the path of Flutter SDK (Where Flutter is installed on your windows machine) so it can run and use Flutter SDK.

flutter sdk path android studio
configuring flutter sdk path

Click Next and than click Finish.

Android Studio will create sample Flutter Application which can be installed on Android Device or Emulator.

Running Flutter App on Android device:

After you install Flutter demo app on your Android device you will see below screen which has two TextViews and one Floating Action Button.

0 will increment everytime you click FAB.

flutter demo app android
flutter demo android studio

Flutter Project Structure:

Open Project directory, code for your application is in lib/main.dart file.

flutter android studio project directory
flutter android studio project structure

Hot Reload Flutter:

Flutter has hot reload feature which keeps your application state if you make code changes in your Flutter app and click hot reload button in Android Studio Flutter will immediately show changes on your Android device.

Hot reload is similar to Instant Run in Android Studio.

Adding Flutter Dependencies:

We can third-party libraries and dependencies in our Flutter Android App.

From your project directory open pubspec.yaml.

Under dependencies, section add dependencies like this.

We are adding cupertino_icons and english_words library in our Flutter Sample app.

name: flutter_app
description: A new Flutter application.

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.0
  english_words: ^3.1.0

Conclusion:

We have learned How to install Flutter on Windows, How to configure Flutter SDK with Android Studio.

How to use Dart with Flutter, How to install packages and dependencies in Flutter apps.

If you have learned something from this article share it on social media and if you want to add anything you can write in comments.

Thank you 🙂

copyright @ http://www.developine.com

Post Created 30

One thought on “How To Develop An Android App With Flutter SDK Using Dart Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search above and press enter to search. Press ESC to cancel.

Back To Top