isInstanceOf method
Whether value is of type or of a subtype of it.
Dart cannot test value is T for a Type value without reflection;
this uses the test registered for type here or in the parent
(the generator registers one for every type written in an annotation,
such as @Transactional(noRollbackFor: [OutOfStock])), and without
one compares the exact runtime type.
Implementation
bool isInstanceOf(Type type, Object? value) {
if (_typeTest(type) case final test?) {
return test(value);
}
return value != null && value.runtimeType == type;
}