What is the difference between the interface abstract class and the simple abstract class in the current Dart 3.0 version, which one is better and what are the possibilities of both?
I did not notice the difference between the two, but they asked it as a question in the company
I assume you are asking about differences in those two declarations:
abstract interface class BaseInterface {}
abstract class BaseClass {}
In Dart, classes have implicit interfaces and all classes can be used as interfaces. So both of those can have declarations, implementations and be used in implements sections.
interface keyword in Dart:
Libraries outside of the interface’s own defining library can implement the interface, but not extend it.
https://dart.dev/language/class-modifiers#interface
So in short BaseInterface can not be extended. It can help you enforce user of this class to use it as classic OOP interfaces are intended to be used.
More info: https://dart.dev/language#interfaces-and-abstract-classes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With