whenOrNull<TResult extends Object?> method
- @optionalTypeArgs
- TResult? $default(
- 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,
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? 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,
) {
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 null;
}
}