0% found this document useful (0 votes)
20 views26 pages

Chapter 2 (JY) - Flutter & Dart Basics (Part 2)

Uploaded by

dxrshx101
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)
20 views26 pages

Chapter 2 (JY) - Flutter & Dart Basics (Part 2)

Uploaded by

dxrshx101
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/ 26

Flutter &

Dart
Fundamentals
(Part 2)
6002CEM
Mobile App Development
Flutter & Dart Learning Steps

Install Android Studio with Flutter to prepare for


building apps.

Understanding the Flutter Architecture

Learn Flutter & Dart Basics (This Chapter)

Create your first Flutter app

Create other Flutter apps


The Art of Effective Learning
Important activities that ensure your success in learning Dart
language:

Watching
effective
Attending tutorial videos Studying
lecture & (YouTube) – examples / Doing hands-
practical the art of tutorials / on projects.
classes. choosing the sample
right video to
watch.
The Art of Effective Learning
Important activities that ensure your success in learning Dart
language:

Watching
effective
Attending tutorial videos Studying
lecture & (YouTube) – examples / Doing hands-
practical the art of tutorials / on projects.
classes. choosing the sample
right video to
watch.
The Art of Effective Learning
Important activities that ensure your success in learning Dart
language:

Watching
effective
Attending tutorial videos Studying
lecture & (YouTube) – examples / Doing hands-
practical the art of tutorials / on projects.
classes. choosing the sample
right video to
watch.
The Art of Effective Learning
Important activities that ensure your success in learning Dart
language:

Watching
effective
Attending tutorial videos Studying
lecture & (YouTube) – examples / Doing hands-
practical the art of tutorials / on projects.
classes. choosing the sample
right video to
watch.
Learning Outcomes

• At the end of this lecture, you should be able to:


• Write basic code in Dart with the correct syntax.
• Use comments, variables, operators and selection structure in Dart.
Dart Comments

Example:

//This is a Dart Program


How to run a Dart program from your browser without using an
IDE?

• Go to:
• https://dartpad.dev/
Basic Data Types (Most Used)

• String
• int
• double
• bool
Math Operators

Operation Symbol Used


Addition +
Subtraction -
Multiplication *
Division /
Modulus %
Comparison Operators

Operation Symbol Used


Equal To ==
Not Equal To !=
Greater Than >
Less Than <
Greater Than or Equal To >=
Less Than or Equal To <=
Logical Operators

Operation Symbol Used


AND &&
OR ||
NOT !
IF Statements

if(conditions){
……
}else if(conditions){ Which
…… programming
}else{ language is
…… using the same
} syntax as this?
Conditional Statements - Example

if(age >= 18) {

print(“You are an adult”);

}else if(age >= 13){

print(“You are a Teenager”);

}else{

print(“You are still a child!”)


}
Switch Statements - Example
String grade = “A”;

switch(grade){
case “A”:
print(“Excellent”);
break;
case “B”:
print(“Good”);
break;
case “C”:
print(“Average”)
break;
case “D”:
print(“Poor”)
break;
default:
print(“Invalid Grade”)
}
For Loop

for(initialization; condition; iteration){

}
For Loop – Example 1

for(int i=0; i<10; i++){


if(i == 6)
break;

print(i); Break out of


the loop when
} i is 6
For Loop – Example 2

for(int i=0; i<10; i++){


if(i == 6)
continue;
Skip the iteration
print(i); when i is 6.
The results will print
} the values before 6
and after 6, but will
not print 6.
While Loop
while(condition){
……
……
}
While Loop - Example

while(countdown > 0){


print(countdown);
countdown--;
}
Function – Example 1 (Without parameter & Return Type)

void greet(){
print(“Hello, World!”);
}
Function – Example 2 (With Parameter but Without Return Type)

void greetSomeone(String name){


print(“Hello, ” + name);
}

Or

void greetSomeone(String name){


print(“Hello, $name”);
}
Function – Example 3 (With Parameters & Return Type)

int sum(int a, int b){


return a+b;
}
Data Structures – List Example

List<int> numbers = [10, 20, 30, 40];

for(int i=0; i<numbers.length; i++){


print(numbers[i]);
}
Data Structures – Map Example

Map user = {
'name': 'Selena G',
'age': 88,
'height': 168,
};

print(user['name'] + ", age:" + user['age'].toString());

You might also like