ðĶē Dart â Learn From Zero
Playground: DartPad â click, type, run.
What is Dart?
Dart is a client-optimized language by Google, best known for Flutter (cross-platform UI). Compiles to native or JS.
- Cross-platform apps (Flutter)
- Web frontends
- CLI tools
- Server-side
Run Online â No Install
Use the playground links above.
ðĒ Beginner â Core Basics
Your First Program
dart
void main() {
print("Hello, world!");
}Entry point is main().
Variables & Types
dart
var name = "Ada";
int age = 36;
double height = 1.78;
bool isStudent = true;Use var or explicit types.
If / Else
dart
var age = 18;
if (age >= 18) {
print("Vote");
} else {
print("Too young");
}C-style control flow.
Loops
dart
for (var i = 0; i < 5; i++) print(i);
for (var f in ["a", "b"]) print(f);Iterate with for-in.
Functions
dart
String greet(String name) => "Hello, $name!";Arrow => for one-liners.
Lists & Maps
dart
var fruits = ["apple", "banana"];
fruits.add("cherry");
var m = {"name": "Ada", "age": 36};Lists and maps are built-in.
ðĄ Intermediate â Building Real Programs
Classes
dart
class Person {
String name;
Person(this.name);
}Constructor shorthand this.name.
OOP
dart
abstract class Animal { void speak(); }
class Dog extends Animal { void speak() {} }Inheritance with extends.
async/await
dart
Future load() async {
return await Future.value("x");
} Futures are like Promises.
Null Safety
dart
String? name;
print(name?.length ?? 0);Sound null safety by default.
Collection Methods
dart
var even = [1,2,3,4].where((n) => n.isEven);Functional operations.
ðī Advanced â Pro Concepts
Mixins
dart
mixin Logger { void log() => print("log"); }
class A with Logger {}Reuse implementations via with.
Generics
dart
class Box { T? value; } Type parameters.
Streams
dart
Stream nums = Stream.periodic(Duration(seconds: 1), (i) => i); Async sequences.
Isolates
dart
import "dart:isolate";
// spawn isolates for parallelismConcurrency without shared memory.
What's Next?
- Build a tiny project: Calculator, To-Do App, Weather Widget
- Read the official docs and a good book
- Solve Exercism exercises
- Join a community & share your code
Practice daily for 20 minutes. Consistency > intensity.