🎯 Lesson 1: Your First Dart App
Welcome to Dart! Let's Build Something Cool
Instead of just reading about Dart, we're going to build a real project together - step by step, line by line. No experience needed!
Our Project: "Greeting Generator 3000"
We'll build a fun command-line app that:
- 👋 Greets users by name
- 🎂 Calculates their age
- 🎨 Generates fun ASCII art
- 📊 Shows cool statistics
Before We Start: Quick Setup
We need 3 things installed on your computer. Click each item to see exactly how to do it!
👇 Scroll down — the full step-by-step setup guide is right below!
Complete Setup Guide for Beginners
Never coded before? No problem. Follow these 3 parts carefully and you'll be ready in about 10 minutes .
💻 What computer are you using?
📦 Install the Dart SDK
-
Go to the Dart downloads page
Open your browser and visit: https://dart.dev/get-dart -
Download the Windows installer
Click the big "Windows" button and download the.exefile. It's usually called something likedart-sdk-windows-x64.zip. -
Easier option — use Chocolatey (recommended)
If you have Chocolatey installed, open PowerShell as Administrator and run:PS> choco install dart-sdk -
Verify it worked
Open the Command Prompt (press Win + R , typecmd, press Enter) and type:> dart --versionYou should see something like:Dart SDK version: 3.x.x. If you do — 🎉 Dart is installed!
💙 Install VS Code
-
Download VS Code
Go to https://code.visualstudio.com/ and click the big download button for your operating system. -
Run the installer
Open the downloaded file and follow the installation steps. The defaults are fine — just click "Next" until it's done.💡 Windows tip: On the install options page, check both "Add 'Open with Code' action" boxes. This lets you right-click any folder and open it in VS Code — very handy! -
Open VS Code
Once installed, launch VS Code. You'll see a welcome screen. That's it — VS Code is ready!
🧩 Install the Dart Extension in VS Code
-
Open the Extensions panel
In VS Code, click the puzzle-piece icon on the left sidebar — or press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac).🔍 Search ExtensionsDartDart Code • ⭐ 4.9M downloads👆 This is what you'll see inside VS Code. Search for "Dart" and click Install.
-
Search for "Dart"
TypeDartin the search box. The first result should be "Dart" by Dart Code with millions of downloads. -
Click "Install"
Click the blue Install button. It only takes a few seconds. -
Reload VS Code if asked
VS Code may show a "Reload Required" button — click it. The extension is now active!
Make Sure Everything Works
Let's confirm Dart + VS Code are talking to each other correctly.
-
Open VS Code's built-in Terminal
In VS Code, press Ctrl+` (the backtick key, top-left of keyboard) — or go to View → Terminal from the menu bar. A terminal panel opens at the bottom.💡 What's the terminal? It's a text-based window where you type commands. Think of it as a direct line to your computer. -
Run the version check
$ dart --version✅ Expected output:
Dart SDK version: 3.x.x (stable)
❌ If you see an error: Dart isn't in your PATH yet — revisit Part 1 . -
Check VS Code recognises Dart
Look at the bottom-left of VS Code. After installing the Dart extension with the SDK present, you should see a small Dart SDK version number in the status bar. If you see it — you're 100% ready! 🚀
✅ All set? Let's start coding!
Create Your First Dart Project
🤔 What just happened?
The
dart create
command is like a project wizard - it automatically creates all the files and folders you need. Think of it as setting up a new house with all the rooms already built!
Explore the Project Structure
Click on a file to see what it does!
Each file and folder has a specific purpose in your project.
Write Your First Dart Code
My name is Student
🔍 Code Anatomy
Variables: Your Program's Memory
🎨 Variable Types Visual Guide
String
int
double
bool
🎮 Try It: Variable Playground
String name = "Alice";
int age = 25;
double favoriteNumber = 7.5;
Output: Hello Alice, you are 25 years old and your favorite number is 7.5!
Make It Interactive: Command Line Arguments
📊 Before vs After
❌ Without Arguments
void main() {
print('Hello World');
// Can't get user input!
}
✅ With Arguments
void main(List args) {
var name = args.isNotEmpty ? args[0] : 'Guest';
print('Hello $name! 👋');
}
🎮 Knowledge Check: Quick Quiz
Loading question...
Practice Projects
Apply what you've learned by building these hands-on projects.