🎯 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
What You'll Need
Step 1
Create Your First Dart Project
$
dart create greeting_generator
🤔 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!
Step 2
Explore the Project Structure
greeting_generator/
bin/
greeting_generator.dart
lib/
test/
pubspec.yaml
Click on a file to see what it does!
Each file and folder has a specific purpose in your project.
Step 3
Write Your First Dart Code
✏️ Code Editor
🔴 Live Preview
12345678
📤 Output
Hello from my first Dart app! 🎉
My name is Student
My name is Student
🔍 Code Anatomy
void main()
The starting point - every Dart program begins here!
print()
Shows text in the console - like talking to your program
String myName
A container that holds text - like a labeled box
$myName
Puts a variable's value inside text - like filling in a blank
Step 4
Variables: Your Program's Memory
🎨 Variable Types Visual Guide
String
"Hello World"
int
42
double
3.14
bool
true/false
🎮 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!
Step 5
Make It Interactive: Command Line Arguments
🖥️ Command Line Simulator
$ dart run greeting_generator.dart
💡 Try: dart run greeting_generator.dart Alice 25
📊 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! 👋');
}
🏆
Your Mission: Build the Greeting Generator!
📋 Requirements Checklist
💡 Stuck? Get Progressive Hints
Hint 1: Start with the basic structure
🎮 Knowledge Check: Quick Quiz
Loading question...
Score: 0/5 | Streak: 🔥 0