Dart Introduction

Understanding Google's modern programming language

🎯 What is Dart?

Dart is a client-optimized programming language developed by Google for fast apps on any platform. It's designed for building mobile, desktop, server, and web applications with modern features and excellent performance.


// Simple Dart program
void main() {
  print('Welcome to Dart programming!');
}
                                    

Output:

Welcome to Dart programming!

Key Dart Features

🔒

Type Safe

Catches errors before runtime

String name = 'John';
int age = 25;

Fast Development

Hot reload for instant changes

void main() {
  print('Changes appear instantly!');
}
🎨

Modern Syntax

Clean and readable code

var numbers = [1, 2, 3, 4, 5];
numbers.forEach(print);
🌐

Cross Platform

One code, multiple platforms

// Runs on mobile, web, desktop
void main() => runApp(MyApp());

🔹 Dart vs Other Languages

How Dart compares to popular programming languages:

// Dart - Clean and modern
void main() {
  var message = 'Hello World';
  print(message);
}

// Similar to Java but simpler
// Similar to JavaScript but type-safe
// Similar to C# but more concise

Output:

Hello World

🔹 What Can You Build with Dart?

Dart powers many types of applications:

📱 Mobile Apps (Flutter)

  • iOS and Android apps from single codebase
  • Native performance and beautiful UIs
  • Used by Google, Alibaba, BMW, and more

🌐 Web Applications

  • Modern web apps with Dart web
  • Progressive Web Apps (PWAs)
  • Compiles to optimized JavaScript

🖥️ Desktop Applications

  • Windows, macOS, and Linux apps
  • Native desktop performance
  • Single codebase for all platforms

🔹 Your First Dart Program

Every Dart program starts with a main() function:

// The main function - entry point of every Dart program
void main() {
  // This is where your code starts running
  print('My first Dart program!');
  
  // You can add more code here
  print('Dart is awesome!');
}

Output:

My first Dart program!

Dart is awesome!

🔹 Dart History

A brief timeline of Dart development:

  • 2011: Dart announced by Google
  • 2013: Dart 1.0 stable release
  • 2017: Flutter framework launched
  • 2018: Dart 2.0 with strong typing
  • 2021: Dart 2.12 with null safety
  • Present: Dart 3.0+ with modern features

🧠 Test Your Knowledge

What is the entry point of every Dart program?