Paramclasses Academy - Blog

Tutorials Details

←
Post 5 of 40
→

Dart Programming Tutorial for Beginners: Syntax, Variables and Data Type

Dart Programming Tutorial for Beginners: Syntax, Variables and Data Type

November 2, 2026

❖ Dart Programming Tutorial for Beginners: Syntax, Variables and Data Types

✦ Welcome to Param Classes!

If you want to become a Flutter app developer, learning Dart programming is an important first step. Dart is the programming language used by Flutter to build mobile, web, and desktop applications.

Before creating attractive app designs, login screens, or database-connected applications, you should understand basic programming concepts such as variables, data types, syntax, and output statements.

In this tutorial by Param Classes, we will learn Dart programming from the beginning with simple explanations and practical code examples. Even if you have never written a program before, you can follow these steps.

✦ 1. What Is Dart Programming?

Dart is a modern, object-oriented programming language developed by Google.

It is mainly known as the programming language used for Flutter application development. Dart helps developers write application logic, handle user input, process data, and create interactive applications.

Some important features of Dart:

  • Easy-to-understand programming syntax.

  • Object-oriented programming support.

  • Strong type system with type inference.

  • Asynchronous programming support.

  • Useful libraries for application development.

  • Excellent integration with Flutter.

Example: A Flutter application can use Dart to accept a user's name, calculate a total amount, validate a form, or display information received from an API.

✦ 2. Set Up Dart Programming Environment

Before writing Dart programs, you need a suitable development environment.

You can use DartPad to practise Dart code directly in your browser without installing anything.

DartPad: https://dartpad.dev/

If you want to work on your computer, download the Dart SDK from the official website:

https://dart.dev/get-dart

You can also write Dart code using Android Studio or Visual Studio Code with the appropriate Dart development support.

For beginners, DartPad is a simple way to start learning.

✦ 3. Understand Basic Dart Syntax

Syntax means the rules used to write a programming language.

Every programming language has its own syntax. In Dart, statements generally end with a semicolon (;).

Let's write our first Dart program.

Example 1: Print a Message

void main() {
  print("Hello World!");
}

Output:

Hello World!

Explanation:

  • void means the function does not return a value.

  • main() is the entry point of a Dart application.

  • Curly brackets { } contain the function's code.

  • print() displays information in the output.

  • "Hello World!" is a text value.

  • ; marks the end of the statement.

The main() function is where a basic Dart program starts executing.

✦ 4. What Are Variables in Dart?

A variable is a named storage location used to hold a value.

For example, you can store a student's name, age, mobile number, course name, or fee amount in variables.

Example 2: Create Variables

void main() {
  String studentName = "Rahul";
  int age = 21;
  double fees = 15000.50;

  print(studentName);
  print(age);
  print(fees);
}

Output:

Rahul
21
15000.5

Explanation:

  • studentName stores text.

  • age stores a whole number.

  • fees stores a decimal number.

You can use variables to store and work with information in your application.

✦ 5. Important Data Types in Dart

A data type tells Dart what kind of value a variable can store.

Let's understand some commonly used Dart data types.

❖ 1. String

String is used to store text.

void main() {
  String name = "Amit";
  String course = "Flutter Development";

  print(name);
  print(course);
}

❖ 2. int

The int data type stores whole numbers without decimal points.

void main() {
  int age = 22;
  int marks = 85;

  print(age);
  print(marks);
}

❖ 3. double

The double data type stores decimal numbers.

void main() {
  double price = 499.99;
  double percentage = 85.5;

  print(price);
  print(percentage);
}

❖ 4. bool

The bool data type stores only two possible values: true or false.

void main() {
  bool isStudent = true;
  bool isLoggedIn = false;

  print(isStudent);
  print(isLoggedIn);
}

❖ 5. List

A List stores multiple values in an ordered collection.

void main() {
  List<String> students = [
    "Rahul",
    "Amit",
    "Priya"
  ];

  print(students);
  print(students[0]);
}

Output:

[Rahul, Amit, Priya]
Rahul

Remember that List indexing starts from 0, not 1.

❖ 6. Map

A Map stores information in key-value pairs.

void main() {
  Map<String, dynamic> student = {
    "name": "Rahul",
    "age": 21,
    "course": "Flutter"
  };

  print(student["name"]);
  print(student["age"]);
}

Output:

Rahul
21

Here, name, age, and course are keys, while their associated values contain the student's information.

✦ 6. Difference Between var, final and const

Dart provides different ways to declare variables.

❖ var

The var keyword allows Dart to infer the variable's type from its initial value.

void main() {
  var name = "Rahul";

  name = "Amit";

  print(name);
}

Dart infers that name is a String. You can change its value, but you cannot assign a value of a different type.

❖ final

A final variable can be assigned only once.

void main() {
  final city = "Raipur";

  print(city);
}

You cannot assign another value to city after its first assignment.

❖ const

A const variable represents a compile-time constant.

void main() {
  const pi = 3.14;

  print(pi);
}

Use const when the value is known at compile time and should not change.

Quick Difference:

Keyword Meaning
var Type is inferred; value can be reassigned with the same type
final Can be assigned only once
const Compile-time constant

✦ 7. Comments in Dart

Comments are notes written inside the code. They help explain what the program does. Dart ignores comments when executing the program.

Single-line comment:

// This is a single-line comment

void main() {
  print("Welcome to Dart");
}

Multi-line comment:

/*
This is a multi-line comment.
It can contain multiple lines.
*/

void main() {
  print("Learning Dart");
}

Comments are useful when working on large projects with multiple files and functions.

✦ 8. Practical Example: Student Information Program

Now let's combine variables and data types in one practical example.

void main() {

  String studentName = "Rahul";
  int age = 21;
  String course = "Flutter Development";
  double fees = 15000.50;
  bool isRegistered = true;

  print("Student Information");
  print("-------------------");

  print("Name: $studentName");
  print("Age: $age");
  print("Course: $course");
  print("Fees: $fees");
  print("Registered: $isRegistered");

}

Output:

Student Information
-------------------
Name: Rahul
Age: 21
Course: Flutter Development
Fees: 15000.5
Registered: true

What did you learn from this example?

You created variables for student information and stored different types of values in them. You then used print() to display the complete information.

This type of programming logic is useful when building student management systems, registration forms, and Flutter applications.

✦ 9. Practice Tasks for Beginners

Try these small exercises in DartPad.

Task 1: Create variables for your name, age, and city. Print all three values.

Task 2: Create two integer variables and print their sum.

Task 3: Create a double variable for a product price and print it.

Task 4: Create a Boolean variable named isLoggedIn and assign it true.

Task 5: Create a List containing five student names and print the third name.

Task 6: Create a Map containing a student's name, age, and course.

Practising these exercises will help you understand how Dart stores and displays information.

✦ 10. Why Is Dart Important for Flutter Development?

Dart is the foundation of Flutter application development. When you create a Flutter project, you write Dart code to build the user interface and manage application behaviour.

For example:

  • Variables store user information.

  • Data types define the kind of information.

  • Functions perform specific tasks.

  • Conditions make decisions.

  • Loops repeat operations.

  • Classes and objects help organize application code.

Once you understand these concepts, learning Flutter widgets and building complete applications becomes easier.

At Param Classes, we recommend learning Dart step by step before moving towards practical Flutter projects.

✦ Conclusion

In this tutorial, we learned what Dart programming is, how to write basic Dart syntax, how to create variables, and how to use important data types such as String, int, double, bool, List, and Map.

We also explored var, final, const, comments, and a practical student information program.

Remember, programming cannot be mastered by reading alone. Open DartPad, write the examples yourself, change the values, and practise regularly.

Param Classes encourages beginners to build a strong programming foundation before moving towards advanced app development.

Learn Today, Grow Tomorrow — Param Classes!

←
Post 5 of 40
→