castAsOrNull<T> function
T?
castAsOrNull<T>(
- dynamic input
Similar to letAsOrNull, but uses a try-catch block internally.
Implementation
T? castAsOrNull<T>(dynamic input) {
try {
return input as T;
} catch (_) {
return null;
}
}