0% found this document useful (0 votes)
23 views5 pages

Experiment I

Uploaded by

fakefakke0001
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)
23 views5 pages

Experiment I

Uploaded by

fakefakke0001
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

EXPERIMENT - I

1. a) Install Flutter and Dart SDK.

a) Aim:

To install Flutter and Dart SDK and configure the environment for Flutter app development.

b) Steps to Install Flutter and Dart SDK

1. Download Flutter

• Visit the official Flutter Get Started page.


• Choose your operating system (Windows, macOS, or Linux) and download the Flutter
SDK.
2. Extract Flutter SDK

• Extract the downloaded ZIP file to a location where you want to store it:

o Windows: C:\flutter

o macOS: /Users/<your-username>/flutter

o Linux: ~/flutter

3. Add Flutter to System PATH

This allows you to run Flutter commands from any terminal or command prompt.

For Windows:
• Press Start → Search “env” → Click “Edit the system environment variables”.

• In “System Properties” → Click “Environment Variables”.

• Under “System Variables” → Find and edit the Path variable.

• Click New → Add C:\flutter\bin → Click OK.

For macOS / Linux:

• Open Terminal.

• Run: nano ~/.bash_profile (or .bashrc or .zshrc depending on your shell).


• Add:

export PATH="$PATH:/path/to/flutter/bin"

• Save changes with Ctrl + X, then Y, then Enter.


4. Verify Flutter Installation
• Open a new terminal and run:

flutter --version

• It should display the installed Flutter version and system info.

5. Install Flutter Dependencies

• Install Android Studio (recommended) for Android SDK and Emulator.

• Optionally, install Xcode (for macOS) if building for iOS.

6. Dart SDK Installation

• Note: Dart SDK is bundled with Flutter, no need to install separately.

• If required, Dart can also be downloaded from:


https://dart.dev/get-dart

Result:

Flutter and Dart SDK were successfully installed and configured. The system is now ready for
developing and running Flutter applications.
1. b) Write a simple Dart program to understand the language basics.
Aim

To write a Dart program that demonstrates the use of basic data types, conditional statements,
loops, lists, and maps.

Apparatus / Requirements

• Dart-enabled environment (DartPad or IDE like VS Code)

• Computer with Dart SDK or internet access

Source Code
void main() {

// Variables and data types

int myNumber = 10;

double myDouble = 3.14;

String myString = 'Hello World';

bool myBool = true;

// Printing variables

print('My number is: $myNumber');


print('My double is: $myDouble');

print('My string is: $myString');

print('My boolean is: $myBool');

// Basic arithmetic operations

int result = myNumber + 5;

print('Result of addition: $result');

// Conditional statements
if (myBool) {

print('myBool is true');

} else {
print('myBool is false');

}
// Loops
for (int i = 0; i < 5; i++) {

print('Iteration $i');

// Lists

List<int> numbers = [1, 2, 3, 4, 5];

print('First element of the list: ${numbers[0]}');

print('Length of the list: ${numbers.length}');


// Maps

Map<String, int> ages = {

'Kiran': 30,

'Raj': 25,

'Alekya': 35,

};

print('Kiran\'s age: ${ages['Kiran']}');


}

Output:
My number is: 10
My double is: 3.14

My string is: Hello World

My boolean is: true

Result of addition: 15

myBool is true

Iteration 0

Iteration 1
Iteration 2

Iteration 3

Iteration 4
First element of the list: 1
Length of the list: 5

Kiran's age: 30
Result

The Dart program executed successfully and demonstrated:

• Declaration and usage of various data types

• Conditional control using if-else

• Iteration using a for loop

• Use of List and Map collections

You might also like