whenOrNull<TResult extends Object?>  method 
      
  
TResult?
whenOrNull<TResult extends Object?>( 
    
- TResult? $default(- String topic,
- String pairingTopic,
- Relay relay,
- int expiry,
- bool acknowledged,
- String controller,
- Map<String, Namespace> namespaces,
- ConnectionMetadata self,
- ConnectionMetadata peer,
- Map<String, RequiredNamespace> ? requiredNamespaces,
- Map<String, RequiredNamespace> ? optionalNamespaces,
- Map<String, String> ? sessionProperties,
- List<Cacao> ? authentication,
- TransportType transportType,
 
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 topic,  String pairingTopic,  Relay relay,  int expiry,  bool acknowledged,  String controller,  Map<String, Namespace> namespaces,  ConnectionMetadata self,  ConnectionMetadata peer,  Map<String, RequiredNamespace>? requiredNamespaces,  Map<String, RequiredNamespace>? optionalNamespaces,  Map<String, String>? sessionProperties,  List<Cacao>? authentication,  TransportType transportType)?  $default,) {final _that = this;
switch (_that) {
case _SessionData() when $default != null:
return $default(_that.topic,_that.pairingTopic,_that.relay,_that.expiry,_that.acknowledged,_that.controller,_that.namespaces,_that.self,_that.peer,_that.requiredNamespaces,_that.optionalNamespaces,_that.sessionProperties,_that.authentication,_that.transportType);case _:
  return null;
}
}