← Map
Dart Island · Level 6
Learn Flutter

Classes & Objects

A class is a blueprint — it defines what data and behaviour an object has. An object is a real instance created from that blueprint.
Play 12 mini-games to go from writing your first class to designing complex ones.
What is a class?

Think of a class as a cookie cutter. You define its shape once, then stamp out as many cookies (objects) as you need. Each object has its own copy of the data.

class Dog {
String name;
int age;
Dog(this.name, this.age);
void bark() => print('Woof!');
}
// Create an object:
var dog = Dog('Rex', 3);
print(dog.name); // Rex
  • Fields — data stored in the object (name, age)
  • Constructor — special method to create an object
  • Methods — behaviour the object can perform (bark)
Progress
0 / 12 mini-games solved
Stage 1

Blueprint Builder

Drag fields into the class template.

A Dog class needs fields. Click each field below to add it to the class blueprint.

class Dog {
// add fields here
}
Island map