I am using mirrors and would like to determine if one ClassMirror is a subtype of another. Sort of something like:
ClassMirror type = me.getField(someSymbol).type;
// obviously this won't work, since a ClassMirror is not a List
if(type.originalDeclaration is List) {
...
}
Really I'm looking for something like Java's Class.isAssignableFrom(Class), i.e, a first order isa operator. Walking up the type hierarchy myself feels a bit klunky, especially in the presence of mixins, and would (hopefully) be slower than what the dart runtime / compiler could provide. Is there a built-in method to do this?
TypeMirror.isSubtypeOf(), TypeMirror.isAssignableTo(), ClassMirror.isSubclassOf() have been added in Dart 1.2. (As of writing this is the dev channel, They should appear in the next Dart stable release.)