maybeWhen<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- XrayAddress address,
- XrayAddress? clientIp,
- int? port,
- bool? skipFallback,
- XrayStringList? domains,
- XrayStringList? expectedIPs,
- XrayStringList? expectIPs,
- DnsQueryStrategy? queryStrategy,
- String? tag,
- int? timeoutMs,
- bool? disableCache,
- bool? serveStale,
- int? serveExpiredTTL,
- bool? finalQuery,
- XrayStringList? unexpectedIPs,
- bool? simplified,
- 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( XrayAddress address, XrayAddress? clientIp, int? port, bool? skipFallback, XrayStringList? domains, XrayStringList? expectedIPs, XrayStringList? expectIPs, DnsQueryStrategy? queryStrategy, String? tag, int? timeoutMs, bool? disableCache, bool? serveStale, int? serveExpiredTTL, bool? finalQuery, XrayStringList? unexpectedIPs, bool? simplified)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _NameServerConfig() when $default != null:
return $default(_that.address,_that.clientIp,_that.port,_that.skipFallback,_that.domains,_that.expectedIPs,_that.expectIPs,_that.queryStrategy,_that.tag,_that.timeoutMs,_that.disableCache,_that.serveStale,_that.serveExpiredTTL,_that.finalQuery,_that.unexpectedIPs,_that.simplified);case _:
return orElse();
}
}