isInstanceOf<T> static method
Asserts that the given obj
is an instance of type T
.
Throws an InvalidArgumentException
with the given message
if the object is not of the expected type.
Example:
Assert.isInstanceOf<String>(value, 'Expected a String');
Implementation
static void isInstanceOf<T>(Object? obj, String message) {
if (obj is! T) {
throw InvalidArgumentException(message);
}
}