maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String? congestion,
    2. bool? debug,
    3. String? bbrProfile,
    4. Bandwidth? brutalUp,
    5. Bandwidth? brutalDown,
    6. UdpHop? udpHop,
    7. int? initStreamReceiveWindow,
    8. int? maxStreamReceiveWindow,
    9. int? initConnectionReceiveWindow,
    10. int? maxConnectionReceiveWindow,
    11. int? maxIdleTimeout,
    12. int? keepAlivePeriod,
    13. bool? disablePathMTUDiscovery,
    14. int? maxIncomingStreams,
    )?, {
  2. required TResult orElse(),
})

A variant of when that fallback to an orElse callback.

It is equivalent to doing:

switch (sealedClass) {
  case Subclass(:final field):
    return ...;
  case _:
    return orElse();
}

Implementation

@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? congestion,  bool? debug,  String? bbrProfile,  Bandwidth? brutalUp,  Bandwidth? brutalDown,  UdpHop? udpHop,  int? initStreamReceiveWindow,  int? maxStreamReceiveWindow,  int? initConnectionReceiveWindow,  int? maxConnectionReceiveWindow,  int? maxIdleTimeout,  int? keepAlivePeriod,  bool? disablePathMTUDiscovery,  int? maxIncomingStreams)?  $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _QuicParamsConfig() when $default != null:
return $default(_that.congestion,_that.debug,_that.bbrProfile,_that.brutalUp,_that.brutalDown,_that.udpHop,_that.initStreamReceiveWindow,_that.maxStreamReceiveWindow,_that.initConnectionReceiveWindow,_that.maxConnectionReceiveWindow,_that.maxIdleTimeout,_that.keepAlivePeriod,_that.disablePathMTUDiscovery,_that.maxIncomingStreams);case _:
  return orElse();

}
}