maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- int? mark,
- Object? tcpFastOpen,
- TProxyMode? tproxy,
- bool? acceptProxyProtocol,
- XrayTargetStrategy? domainStrategy,
- String? dialerProxy,
- int? tcpKeepAliveInterval,
- int? tcpKeepAliveIdle,
- String? tcpCongestion,
- int? tcpWindowClamp,
- int? tcpMaxSeg,
- bool? penetrate,
- int? tcpUserTimeout,
- bool? v6only,
- @JsonKey.new(name: 'interface') String? interfaceName,
- bool? tcpMptcp,
- List<
CustomSockoptConfig> ? customSockopt, - AddressPortStrategy? addressPortStrategy,
- HappyEyeballsConfig? happyEyeballs,
- List<
String> ? trustedXForwardedFor,
- 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(
int? mark,
Object? tcpFastOpen,
TProxyMode? tproxy,
bool? acceptProxyProtocol,
XrayTargetStrategy? domainStrategy,
String? dialerProxy,
int? tcpKeepAliveInterval,
int? tcpKeepAliveIdle,
String? tcpCongestion,
int? tcpWindowClamp,
int? tcpMaxSeg,
bool? penetrate,
int? tcpUserTimeout,
bool? v6only,
@JsonKey(name: 'interface') String? interfaceName,
bool? tcpMptcp,
List<CustomSockoptConfig>? customSockopt,
AddressPortStrategy? addressPortStrategy,
HappyEyeballsConfig? happyEyeballs,
List<String>? trustedXForwardedFor)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _SocketConfig() when $default != null:
return $default(
_that.mark,
_that.tcpFastOpen,
_that.tproxy,
_that.acceptProxyProtocol,
_that.domainStrategy,
_that.dialerProxy,
_that.tcpKeepAliveInterval,
_that.tcpKeepAliveIdle,
_that.tcpCongestion,
_that.tcpWindowClamp,
_that.tcpMaxSeg,
_that.penetrate,
_that.tcpUserTimeout,
_that.v6only,
_that.interfaceName,
_that.tcpMptcp,
_that.customSockopt,
_that.addressPortStrategy,
_that.happyEyeballs,
_that.trustedXForwardedFor);
case _:
return orElse();
}
}