How To Define an Interface in Dart

Dart defines implicit interfaces. What does this mean?

In your app you’d have:

class Session {
  authenticate() { // impl }


abstract class Session {

And for example in tests:

class MockSession implements Session {
  authenticate() { // mock impl }

No need to define a separate interface, just use regular or abstract classes!

Want to know EVERYTHING about Dart constructors? Check out Deconstructing Dart Constructors!