Implicit Interfaces and implements
Treat any class as an interface.
Implicit Interfaces and implements is a free Dart Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Dart Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Every Class Is an Interface
In Dart, each class quietly defines an implicit interface: the full set of its public methods and getters that others can promise to provide.
implements vs extends
With extends you inherit code. With implements you only adopt the shape and must rewrite every member yourself.
class Robot implements Greeter {}A Simple Interface Source
Any ordinary class can act as an interface. Here Greeter defines one method that others can implement.
class Greeter {
String greet() => 'Hi';
}Implementing the Interface
When you implement a class, none of its code carries over. You provide a fresh body for each member it declared.
class Robot implements Greeter {
String greet() => 'Beep';
}You Must Provide Everything
Skipping even one member is a compile error. implements demands the complete interface, with no inherited shortcuts.
class Robot implements Greeter {} // error: greet missingImplementing Several Interfaces
A class can implement many interfaces at once by listing them with commas, gaining all their shapes together.
class Robot implements Greeter, Logger {}Abstract Classes as Interfaces
Pure abstract classes make great interfaces. They declare only signatures, so implementers face no inherited code at all.
abstract class Greeter {
String greet();
}Interface Plus Inheritance
You can mix both: extends one class for its code and implements others for their shapes in the same declaration.
class Robot extends Machine implements Greeter {}Typing Against the Interface
Once a class implements Greeter, you can store it in a Greeter variable and call greet without knowing the concrete type.
Greeter g = Robot();
print(g.greet());Interfaces Stay Decoupled
Because implements copies no behavior, your class stays independent of the original. Change the source freely without inheriting its bugs.
Fields Become Getters
A field in an interface shows up as a getter requirement. You satisfy it with a real field or a computed getter.
class Robot implements Named {
final String name = 'R2';
}Quick Check
One quick question about implementing interfaces.
Recap
Every class exposes an implicit interface. Use implements to adopt its shape, reimplementing every member, and even combine many interfaces at once. 🔌
Frequently asked questions
Is the “Implicit Interfaces and implements” lesson free?
Yes — the full text of “Implicit Interfaces and implements” is free to read here on the web, and the Dart Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Dart Academy course, upgrade to CoddyKit PRO.
What will I learn in “Implicit Interfaces and implements”?
Treat any class as an interface. You practise Dart Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Dart Academy?
No prior experience is required. Dart Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Implicit Interfaces and implements” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Dart Academy lesson?
Yes. Every Dart Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Abstract Classes and Abstract Methods
- Implicit Interfaces and implements
- Polymorphism Through Shared Types
- Composition Over Inheritance