tryAs<T> method
- @useResult
Safely casts the value to T
if it is T
, otherwise returns null
.
Implementation
@useResult
T? tryAs<T>() => this is T ? this as T : null;
Safely casts the value to T
if it is T
, otherwise returns null
.
@useResult
T? tryAs<T>() => this is T ? this as T : null;