I have the following classes and interfaces:
class Place extends Entity
with ChangeNotifier, FieldGetters
implements Scannable, Likable {
// ...some stuff
}
abstract class Likable {
// ... some stuff
}
Entity is just a base class for other classes.
So, the problem is that I want to check whether the object that implements the Likable interface is of class Place or not. To do so, I use the following code:
logger.i('likable is ${like.likable.runtimeType}');
logger.i('likable is Place: ${like.likable is Place}');
The first line works as expected and shows the following output:
I/flutter ( 1635): [38;5;12m┌───────────────────────────────────────────────────────────────────────────────[0m
I/flutter ( 1635): [38;5;12m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄[0m
I/flutter ( 1635): [38;5;12m│ likable is Place[0m
I/flutter ( 1635): [38;5;12m└───────────────────────────────────────────────────────────────────────────────[0m
However, the second line of code acts weird and shows the following:
I/flutter ( 1635): [38;5;12m┌───────────────────────────────────────────────────────────────────────────────[0m
I/flutter ( 1635): [38;5;12m├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄[0m
I/flutter ( 1635): [38;5;12m│ likable is Place: false[0m
I/flutter ( 1635): [38;5;12m└───────────────────────────────────────────────────────────────────────────────[0m
The official documentation suggests that the interface inheritance can be checked via is keyword. I am confused. How can I check the interface inheritance in this case?
Dart: v2.8.1
Flutter: v1.17.0