tryCast<R> method
R?
tryCast<R>()
A safe cast operation that returns null if the cast is not possible. Otherwise, returns the casted value.
Implementation
R? tryCast<R>() {
try {
return this as R?;
} catch (e) {
return null;
}
}