when<TResult extends Object?> method

  1. @optionalTypeArgs
TResult when<TResult extends Object?>(
  1. TResult $default(
    1. List<String> chains,
    2. String domain,
    3. String nonce,
    4. String uri,
    5. CacaoHeader? type,
    6. String? nbf,
    7. String? exp,
    8. String? statement,
    9. String? requestId,
    10. List<String>? resources,
    11. int? expiry,
    12. List<String>? methods,
    )
)

A switch-like method, using callbacks.

As opposed to map, this offers destructuring. It is equivalent to doing:

switch (sealedClass) {
  case Subclass(:final field):
    return ...;
  case Subclass2(:final field2):
    return ...;
}

Implementation

@optionalTypeArgs TResult when<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():
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);}
}