whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
A variant of when
that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? email, String handle, String? did, String? inviteCode, String? verificationCode, String? verificationPhone, String? password, String? recoveryKey, Map<String, dynamic>? plcOp, Map<String, dynamic>? $unknown)? $default,) {final _that = this;
switch (_that) {
case _ServerCreateAccountInput() when $default != null:
return $default(_that.email,_that.handle,_that.did,_that.inviteCode,_that.verificationCode,_that.verificationPhone,_that.password,_that.recoveryKey,_that.plcOp,_that.$unknown);case _:
return null;
}
}