when<TResult extends Object?> method
- @optionalTypeArgs
- TResult $default(
- String? message,
- String? name,
- String? method,
- bool? connected,
- String? network,
- String? explorer_id,
- String? provider,
- String? platform,
- List<
String> ? trace, - String? topic,
- int? correlation_id,
- String? client_id,
- String? direction,
- String? userAgent,
- String? sendToken,
- String? sendAmount,
- String? address,
- String? project_id,
- String? cursor,
A switch
-like method, using callbacks.
As opposed to map
, this offers destructuring.
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case Subclass2(:final field2):
return ...;
}
Implementation
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? message, String? name, String? method, bool? connected, String? network, String? explorer_id, String? provider, String? platform, List<String>? trace, String? topic, int? correlation_id, String? client_id, String? direction, String? userAgent, String? sendToken, String? sendAmount, String? address, String? project_id, String? cursor) $default,) {final _that = this;
switch (_that) {
case _CoreEventProperties():
return $default(_that.message,_that.name,_that.method,_that.connected,_that.network,_that.explorer_id,_that.provider,_that.platform,_that.trace,_that.topic,_that.correlation_id,_that.client_id,_that.direction,_that.userAgent,_that.sendToken,_that.sendAmount,_that.address,_that.project_id,_that.cursor);}
}