- 01Setting up (what you'll need)
- 02Your first output (print)
- 03Variables and types (var and annotations)
- 04Null safety (? and !)
- 05Branching (the if statement)
- 06Repeating (the for loop)
- 07Writing your own function
- 08Repeating (the while loop)
- 09Working with lists (List)
- 10Working with maps (Map)
- 11Classes (object orientation)
- 12Constructors
- 13Inheritance
- 14Named arguments
- 15Asynchronous work (Future, async, await)
- 16Working with strings
- 17The switch statement
- 18The ternary operator
- 19Extension methods
- 20[Project] Build a small inventory system
Inheritance
This lesson covers inheritance, which builds a new class on top of an existing one.
You inherit by writing class Child extends Parent { ... }. Adding @override lets you replace a method of the parent class.
The sample code inherits class Animal with class Dog extends Animal and overrides speak() with dog-specific behaviour.
A common early stumble is passing the constructor along. A child class constructor has to call super(name) to run the parent's initialisation.
In professional work, it is common in Flutter to build a custom widget with a shared style by inheriting from an existing one.
๐งช This site can't compile or run Dart directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ nothing is sent anywhere).
