0% found this document useful (0 votes)
3 views56 pages

Dart and Flutter2

Uploaded by

Anhtk Anhtk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views56 pages

Dart and Flutter2

Uploaded by

Anhtk Anhtk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

DART AND FLUTTER

DART USED IN
Dart has a rich set of core libraries, providing
essentials for many everyday programming tasks:
1. Richer collection types such as queues, linked lists, hashmaps,
and binary trees (dart:collection)
2. Encoders and decoders for converting between different data
representations, including JSON and UTF-8 (dart:convert)
3. Mathematical constants and functions, and random number
generation (dart:math)
4. File, socket, HTTP, and other I/O support for non-web
applications (dart:io)
5. Support for asynchronous programming, with classes such as
Future and Stream (dart:async)
Download the software from the given link below

1. Flutter SDK: https://flutter.dev/

2. Android Studio: https://developer.android.com/studio

Tutorial to install Flutter :

1. For Windows: https://www.youtube.com/watch?v=tun0HUHaDuE

2. For Mac OS: https://www.youtube.com/watch?v=JJwBoRMY08U

3. For Linux: https://www.youtube.com/watch?v=Esb7zwEIHv8


For windows
Open the Start menu and search for “Environment
Variables”.
Click on “Edit the system environment variables”.
Click on the “Environment Variables” button.
Under “System Variables”, scroll down to find “Path” and
click on “Edit”.
Click on “New” and add the path of the Flutter SDK. For
example, “C:src/flutter/bin”.
Click on “OK” to save the changes.
For Linux
Open the Start menu and search for Ubuntu Store.
Click on “Search” and type flutter sdk.
Click on install button.
or type “sudo snap install flutter --classic” in Terminal
Type flutter --doctor
for dart version
dart --version
for flutter
flutter --version
flutter doctor
Plugins
Dart
Flutter
Auto Save enable in Vs code
Color bracket
Material theme
Material Icons
Step 1: Open VS code and type ctrl + shift + p and type Dart: New
void main(){
print(“Hello World”);
}
#void -> return type-> return nothing
int, string, list & bool -> return
something like string number, in function
#main -> execution is name as main()
function
#to print anything “”
-> print(“Hello World”);
DART DATA TYPE
Like other languages (C,C++,Java etc.) ,whenever a variable is
created, each variable has an associated data type.
NUMBER
Number: The number in Dart
Programming is the data type that is
used to hold the numeric value. Dart
numbers can be classified as:
The int data type is used to
represent whole numbers.
The double data type is used to
represent 64-bit floating-point
numbers.
STRING
It is used to represent a
sequence of characters. It is a
sequence of UTF-16 code
units. The keyword string is
used to represent string
literals. String values are
embedded in either single or
double quotes
BOOLEAN
It represents Boolean values
true and false. The keyword bool
is used to represent a Boolean
literal in DART.
LIST
List data type is similar to
arrays in other programming
languages. A list is used to
represent a collection of
objects. It is an ordered
group of objects.
MAP
The Map object is a key and
value pair. Keys and values
on a map may be of any
type. It is a dynamic
collection.
STRING AND STRING INTEPOLATION IN
DART
String can be written in (“”,’’)-> string and
double quotation
String a = “It’s easy” or ‘It/’s easy’
Concatenation Operation to add to String
Text ‘+’
VAR KEYWORD IN DART
Var Keyword to declare variable in dart
-> A way to declare a variable without specifying its type
var a = 20; int / var b=”name”; string/ var c = true; bool
print(a.runtimeType)-> runtimeType helps to check the
variable type
if want to change a value int should be int, bool to bool,
String -> String
VAR KEYWORD IN DART
Sometimes we declare a variable
using the var and we cannot assign
any value in it it will be dynamic
type value.
DYNAMIC KEYWORD IN DART
Keyword-> Change the variable
when we need.
DYNAMIC KEYWORD VS VAR IN DART
FINAL AND CONST KEYWORD
const a = 10; //mainly
used;
final b = 20;
DIFFERENT BETWEEN FINAL AND
CONST KEYWORD
Final Const
set once but it is initialized it content time complexity
when it is accessed const a = 10; (compile
final a = 10; (until and unless memory is consumed)
id we didnot declare the print(a); Same case memory
variable memory will not be will be consumed;
consumed) const variable should be
print(a);initialized now variable
NOTE:
Instance variable can be final variable but cannot be const;
in case of const variable we need to add
Static const a =10 ;
final b = 20;
FOR LOOP
DIFFERENT BETWEEN WHILE AND DO
WHILE LOOP
While Do-while
The while loop is similar to The do…while loop is similar
the for loop except that the to the while loop except
while loop each time the that the do...while loop
condition specified doesn’t evaluate the
evaluates to true. loop condition for the first time
evaluates the condition the loop executes
before the block of code is
executed
Thank You

You might also like