Dart is the language behind Flutter — clean, typed and easy to pick up.
Variables & types
final name = 'Anand'; // can't reassign
var count = 0; // inferred int
int score = 10; // explicit
String? nickname; // nullable (can be null)
Null safety
String greet(String? n) => 'Hi, ${n ?? 'friend'}';
Functions
int add(int a, int b) => a + b;
void log(String msg, {bool loud = false}) {
print(loud ? msg.toUpperCase() : msg);
}
Classes & collections
class User {
final int id;
final String name;
User(this.id, this.name);
}
final nums = [1, 2, 3, 4];
final evens = nums.where((n) => n.isEven).toList();
final doubled = nums.map((n) => n * 2).toList();
Tip: Use
final by default and named parameters ({ }) for readable function calls.Summary
You learned Dart variables, null-safety, functions, classes and collections — the basis for all Flutter code.