Interface
Syntax & Properties of interface
void main() {
// Interfaces in dart
}
abstract class A {
String a;
void testA1();
void testA2() {
print("A2");
}
}
abstract class B {
void testB1();
void testB2() {
print("B2");
}
}
class C implements A, B {
@override
void testB1() {}
@override
void testB2() {}
@override
String a;
@override
void testA1() {}
@override
void testA2() {}
}
Dart implicitly defines a class as an interface, hence called as implicit interface . As there is no interface keyword , implicitly all classes are interfaces . Note: This might change in the future
You can implement multiple interfaces at once
Whenever you implement a interface you must override everything inside it
Interface : Why we use them -1 ?
Interface : Why we use them -2 ?
Last updated
Was this helpful?