0% found this document useful (0 votes)
19 views33 pages

Introduction To Dart Programming: Day 4 Learning Dart As A Foundational Skill For Flutter Development

This document serves as an introduction to Dart programming, emphasizing its importance for Flutter development. It outlines Dart's features, advantages, and basic concepts such as variables, data types, and control statements. Additionally, it provides guidance on setting up the Dart environment and includes assignments for practical application.

Uploaded by

Krishna More
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)
19 views33 pages

Introduction To Dart Programming: Day 4 Learning Dart As A Foundational Skill For Flutter Development

This document serves as an introduction to Dart programming, emphasizing its importance for Flutter development. It outlines Dart's features, advantages, and basic concepts such as variables, data types, and control statements. Additionally, it provides guidance on setting up the Dart environment and includes assignments for practical application.

Uploaded by

Krishna More
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/ 33

Introduction to Dart

Programming

Day 4
Learning Dart as a foundational skill
for Flutter development

Trainer: Aditya Patil


Dart Basics
What is Dart?
Dart is a programming language developed by Google (2011).

Designed specifically for:

> Building modern web, mobile, and desktop apps.

> Powering Flutter for cross-platform UI development.

Features of Dart:

> Fast: Compiles to native code.

> Productive: Supports hot reload for instant UI updates.

> Flexible: Object-oriented with functional programming features.


Advantages of Dart
Why Use Dart?
Advantages:

1. Cross-platform Development: Code once and deploy everywhere.

2. Speed: Ahead-of-time (AOT) compilation ensures faster performance.

3. Hot Reload: Instantly reflect code changes without losing app state.

4. Modern Features:
a. Null safety to reduce runtime errors.
b. Built-in support for asynchronous programming.

5. Easy to Learn: Simple syntax and approachable learning curve.

6. Strong Community Support: Backed by Google and widely adopted.


Setting Up Dart
Environment
Prerequisites for Dart Sdk
1. Visit dart.dev for download links.

2. Follow platform-specific installation steps (Windows/Mac/Linux).

3. Verify installation using:

dart --version
Setting Up IDE
(Integrated Development Environment)
Prerequisites for Android Studio
1. Visit https://developer.android.com/ for download links.

2. Follow platform-specific installation steps (Windows/Mac/Linux).


Creating Your First Dart
Program
Writing Code:
1. Create a file named main.dart.

2. Add the following code:

void main() {
print('Hello, Dart!');
}

Running Code
1. Using terminal:

dart run main.dart


Understanding Dart Syntax
Main Function:
Every Dart program starts with the main() function.
Comments:
Single-line: // This is a comment

Multi-line:
Print Statement:
Variables in Dart
Definition
Variables are containers for storing data values.

Types of Variables:
var: Type inferred by Dart.

final: Value cannot be changed after initialization.

const: Compile-time constant.


Dynamic Variable
Dynamic is another type in Dart that allows changing the variable type at runtime. This means you
can assign a value of one type at runtime and then assign a value of a different type to the same
variable.
Data Types in Dart
Basic Data Types:
1. Numbers:
int: Whole numbers (e.g., 5, -10).

double: Decimal numbers (e.g., 3.14).

2. Strings:
Sequence of characters.

String name = 'Alice';

3. Booleans
Represents true/false values.

bool isActive = true;

4. Lists and Maps:


List: Ordered collection.

Map: Key-value pairs.


Control Statements:
Conditionals
If-Else
Switch-Case
Control Statements: Loops
For Loop:
While Loop:
Do-While Loop:
Conclusion and Q&A
Summary of Day 4
- Dart’s role in Flutter and its advantages.

- Setting up the Dart environment.

- Basic concepts: Variables, data types, and control statements.


Assignment Day - 4
Assignment:
1. Write a Fibbonacci Series program using dart
2. Write a program to check if the number is Prime using dart.
3. Write a program to check whether the String is palindrome or not.
Important Links

1. Dart Official Guide


https://dart.dev/guides
2.
Thank You

You might also like