maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- String? ruleTag,
- String? outboundTag,
- String? balancerTag,
- XrayStringList? domain,
- XrayStringList? domains,
- XrayStringList? ip,
- XrayPortList? port,
- XrayNetworkList? network,
- XrayStringList? sourceIP,
- XrayStringList? source,
- XrayPortList? sourcePort,
- XrayStringList? user,
- XrayPortList? vlessRoute,
- XrayStringList? inboundTag,
- @JsonKey.new(name: 'protocol') XrayStringList? protocols,
- @JsonKey.new(name: 'attrs') Map<
String, String> ? attributes, - XrayStringList? localIP,
- XrayPortList? localPort,
- XrayStringList? process,
- WebhookRuleConfig? webhook,
- 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? ruleTag, String? outboundTag, String? balancerTag, XrayStringList? domain, XrayStringList? domains, XrayStringList? ip, XrayPortList? port, XrayNetworkList? network, XrayStringList? sourceIP, XrayStringList? source, XrayPortList? sourcePort, XrayStringList? user, XrayPortList? vlessRoute, XrayStringList? inboundTag, @JsonKey(name: 'protocol') XrayStringList? protocols, @JsonKey(name: 'attrs') Map<String, String>? attributes, XrayStringList? localIP, XrayPortList? localPort, XrayStringList? process, WebhookRuleConfig? webhook)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _RouterRule() when $default != null:
return $default(_that.ruleTag,_that.outboundTag,_that.balancerTag,_that.domain,_that.domains,_that.ip,_that.port,_that.network,_that.sourceIP,_that.source,_that.sourcePort,_that.user,_that.vlessRoute,_that.inboundTag,_that.protocols,_that.attributes,_that.localIP,_that.localPort,_that.process,_that.webhook);case _:
return orElse();
}
}