isSupertypeOf<TSub> method
Returns true if instance of TSub
is applicable to T
,
as if you would check new TSub() is T
.
Also returns true if T
== TSub
.
WARNING:
isSupertypeOf<T, void>()
will always return true, since void is dynamic at runtime.
To check if T is void, use:
isSubtypeOf<void, T>()
which does not work for dynamic (as stated above).
Implementation
bool isSupertypeOf<TSub>() {
return TypeCheck<TSub>() is TypeCheck<T>;
}