Skip to content
DartMobile App

Dart Programming Tutorial for Beginners: Learn Dart from Scratch

April 25, 2025 2 min read

Dart Programming Tutorial for Beginners

Are you interested in learning Dart programming? Whether you’re planning to dive into Flutter development or simply want to learn a modern, powerful language—this Dart tutorial is the perfect starting point for beginners.

What is Dart?

Dart is an open-source, general-purpose programming language developed by Google. It is optimized for building fast, modern web and mobile apps. Dart is the language behind Flutter, Google’s popular UI toolkit for cross-platform development.

  • Easy to learn for JavaScript, Java, or C# developers
  • Used with Flutter to build Android, iOS, Web, and Desktop apps
  • Fast, expressive, and safe language
  • Strong community support

How to Install Dart?

You can install Dart in two ways:

1. Using Flutter SDK (Recommended)

If you’re learning Dart for Flutter:

Code
https://flutter.dev/docs/get-started/install

2. Install Dart SDK Directly:

Go to https://dart.dev/get-dart and follow the setup instructions for your operating system.

Your First Dart Program

Create a new Dart file and name it hello.dart:

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

Run it:

Code
dart hello.dart

Output:

Code
Hello, Dart!

Dart Basics

1. Variables

Code
void main() {
  var name = 'Shri Kant';
  int age = 25;
  double height = 5.9;
  bool isStudent = true;

  print('$name is $age years old.');
}

2. Data Types

  • int – Integer values
  • double – Decimal values
  • String – Text
  • bool – true or false
  • List – Arrays
  • Map – Key-value pairs

3. Functions

Code
void greet(String name) {
  print('Hello, $name!');
}

void main() {
  greet('Shri Kant');
}

4. Conditionals

Code
void main() {
  int marks = 75;

  if (marks >= 60) {
    print('Pass');
  } else {
    print('Fail');
  }
}

5. Loops

Code
void main() {
  for (int i = 1; i <= 5; i++) {
    print('Number: $i');
  }
}

5.1 While Loops

Code
void main() {
  int i = 1;

  while (i <= 5) {
    print('Number: $i');
    i++;  // Increment i by 1
  }
}

6. Using Lists in Dart

Lists in Dart allow you to store multiple values in a single variable. Here’s an example:

Code
void main() {
  List<String> fruits = ['Apple', 'Banana', 'Orange'];

  for (var fruit in fruits) {
    print(fruit);
  }
}

Explanation:

  • We create a List called fruits to store strings.
  • The for loop iterates over each item in the list and prints it.

Conclusion

Dart is a beginner-friendly yet powerful language for modern app development. Whether you’re coding for web, mobile, or desktop, Dart provides the tools and simplicity to bring your ideas to life.

TheEasyMaster

Author at The Easy Master.

Previous
Most Used React Native CSS Properties: Complete Cheat Sheet
Next
Flutter Widgets Tutorial: From Basics to Advanced

Related posts

Leave a Reply

Your email address will not be published. Required fields are marked *