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( List<String> chains, String domain, String nonce, String uri, CacaoHeader? type, String? nbf, String? exp, String? statement, String? requestId, List<String>? resources, int? expiry, List<String>? methods)? $default,) {final _that = this;
switch (_that) {
case _SessionAuthRequestParams() when $default != null:
return $default(_that.chains,_that.domain,_that.nonce,_that.uri,_that.type,_that.nbf,_that.exp,_that.statement,_that.requestId,_that.resources,_that.expiry,_that.methods);case _:
return null;
}
}