1. Technology
  2. Flutter And Dart Programming
Flutter And Dart Programming

Flutter And Dart Programming

Flutter And Dart Programming
08 May 2021

Introduction to Dart Programming Language -

Dart is an open-source and object-oriented programming language. 
It First introduces at the GOTO conference Aarhus, Denmark, October 2011  by Lars Bak and Kasper (google).
Dart’s stable version was released in June 2017.
Dart is a c-style programming language but it is much more advanced than c or c++.
Dart Virtual Machine helps dart to compile code and It also compiles to JavaScript using dart2.js and run-on browsers.
Dart is used for creating Mobile applications with cross-platform, Desktop applications, web applications, and especially single page web applications (which loads once and working very faster.)

Dart Compiling techniques are AOT and JIT
AOT - ahead of time, it compiles code at built time.
JIT – Just in Time, convert byte code to machine code.


Features of Dart 

1. Open source – dart is an open-source programming language developed by google with a BSD license.

2. Object-Oriented   - dart is an object-oriented programming language it supports inheritance, encapsulation, interface, classes and objects, polymorphism, etc.

3. Platform independent – dart virtual machine converts byte code to machine code, it successfully run-on windows, Linux and Mac operating system.

4. Concurrency controlled – dart uses multi-threading and asynchronous features that provide multiple processes at the same time.

5. Dart Libraries – In dart SDK various methods and classes available that give facility to programmers -math, asynchronous, convert, etc.

6. Typesafe and Flexible – dart is type-safe language.it provides the facility to check null safety at runtime.

7. Browser and JavaScript Support – browser Support dart code with dart2.js compiler. dart2.js compiler converts dart into JavaScript.

8. Collections and Generics – collection and generics are widely used in dart - List, map and set are solve programming problems easily.

 Install dart SDK –

1.visit and Install dart SDK from https://dart.dev/get-dart

2. Install dart SDK and set path in an environment variable.

3, check dart SDK in command prompt type “dart”

4.Create a file in your current directory with the extension name (.dart)
Hello. dart

5. Inside hello.dart file

void main() {      // main function - entry of program
print("Hello-World"); //print fun. for Disp output    
}

6. run the above file using the command 
>Dart Hello. dart 
>Output:  Hello-World

Install Flutter SDK

 
7. Run using online compiler dart pad here https://dartpad.dev/

Advantages of Dart


1. Dart is a new language so the code of this language is easy and short. Syntax of this language is very easy than other languages.

2. Dart supports are easily available on Internet, google backing this language so its requirement is high.

3. Dart performance is high because it is faster than JavaScript or other languages.

4. Dart is stable and support by many IDEs, Extensions of the dart are available on IDE.

5. Dart SDK provides error checking, debugging and IDEs are also showing errors in editing time.

6. Dart ranking is high because google backing up this language.

7. Flutter is a used dart so the popularity of dart is increased in the market for mobile and web applications development.

8. Library support is very strong because of many unique methods, classes used in dart SDK.

9. Best UI/UX designs support by a dart that is compatible everywhere in applications.

Disadvantages of Dart


1. Lack of Documentation Support in the market so maybe some difficulties for solving some specific issues.

2. Not widely used because dart is new in the market and companies slowly adapt features of this.

Flutter Application Development using dart


Flutter framework introduces in the year 2015 at dart summit.
it is used for android/IOS app and single-page web applications development.
Flutter stable version was released in the year 2019.
Flutter framework is used for creating cross-platform mobile applications with the best UI index and responsive design.
Flutter dart programming is trans-compiled to JavaScript code and It runs on the browser easily.
After all Flutter dart is the language of google so it has various Features given below -

1. Hot reload Apps Without Running again you directly save the program and that effect on your screen in seconds.

2. Cross-platform Development - android, IOS, and Single page web application development.

3. Open-source – Flutter is an open-source framework with no purchasing required in the future.

4. Fast development – flutter framework provides various methods and built-in classes that help to develop in a faster way.

5. Best UI design - google is known for the best UI designs. flutter has widgets that support responsive design.

6. Minimum code - flutter framework is done programming with minimum code, solve problems easily with minimal difficulties.
 
7. Flutter Widget – everything that is shown in the body of flutter applications must be used widget tree.

8. Fast running – flutter app’s frames are very fast than another framework android, ionic, Cordova, react-native.

Install Flutter SDK –

1. First of all, you have installed dart SDK.

2. Install git from https://git-scm.com/download/win

3. Install flutter SDK from https://flutter.dev/

4. Set the path of flutter SDK in the environment variable.

5. Run the Flutter Doctor command to check flutter is installed or not.

Then flutter doctor return following Text about requirement--
a. IDE for flutter – Visual studio code and android studio b. Connected Devices - Chrome or web browser for running applications.

6. for creating applications in a flutter in command prompt in your directory where you want to create an application.

>Flutter create MyApp
Then flutter application MyApp package is created.
Inside MyApp following files and directories are created
 
Flutter create Myapp


7.Open flutter MyApp type command-
>cd MyApp

8. run flutter MyApp using command -
>Flutter run lib/main.dart

9.then see the output on browser or mobile

Flutter Myapp

 
How to Run Flutter Applications in IDE –
99 % of work is done under main.dart file ( yourApp/lib/main.dart)

1. Android Studio – Android Studio is for android app development. System requirement is more for this IDE.
 a. Install flutter dart plugin from android studio package
 b. Give flutter SDK path in Android studio
 c. Reopen Android Studio > New flutter project >flutter application >
 d. Type name of flutter project then flutter app directories are created.
 e. Open MyApp/lib/main.dart file and editing as you want.
 f. Click the run button for running the app and choose devices chrome, Mobile, etc.

Android-Studio

 
2. Visual Studio code – This IDE is best for those who have a minimum specification of the system. 
 Visual Studio code has many extensions and support for flutter.

a. Go to Extension in Vs code then install Flutter, dart extensions.
b. clicks on the new flutter application and type the Name of your application.
c. Go to File myapp/lib/main.dart.
d. Edit main. dart file according to you.
e. Click Run and Choose Devices - chrome, mobile, Microsoft edge.

Visual Studio code


Advantages of Flutter


1. Flutter UI/UX index is more popular because it is responsive. smaller and larger devices are not reflecting any kind of difficulties when the app is installed because flutter built-in support is used.

2. No other language is required for IOS applications.
flutter cross-platform development support is here.

3. Widgets are used in the structure of flutter applications. scrolling and touch experience are smooth for users.

4. Flutter Mobile applications are easily converted to web applications because dart2.js compiles Dart code into JavaScript.

5. Dart dev tools are helping for creating the responsive User interface and support on a runtime that tells what is fault on application.

6. Flutter channels are available - master, stable, dev, etc., and user change channels according to requirement.

Disadvantages of Flutter

1. Flutter is new so Documentation support in the market is less than in other languages.

2. When Flutter Web applications are converted into Mobile applications and Mobile applications are converted to web applications then few lines of codes require to change for a better User interface.

3. Some Flutter channels are in the development stage so require working without library support.


Share via
Comment Box is loading comments...