safeAs<R> method
R?
safeAs<R>()
Casts value to R if possible, otherwise returns null.
Implementation
@pragma('vm:prefer-inline')
@pragma('wasm:prefer-inline')
@pragma('dart2js:prefer-inline')
/// Casts [value] to [R] if possible, otherwise returns null.
R? safeAs<R>() {
// ignore: unnecessary_this
return value is R ? this.as<R>() : null;
}