maybeWhen<TResult extends Object?> method

  1. @optionalTypeArgs
TResult maybeWhen<TResult extends Object?>(
  1. TResult $default(
    1. String? message,
    2. String? name,
    3. String? method,
    4. bool? connected,
    5. String? network,
    6. String? explorer_id,
    7. String? provider,
    8. String? platform,
    9. List<String>? trace,
    10. String? topic,
    11. int? correlation_id,
    12. String? client_id,
    13. String? direction,
    14. String? userAgent,
    15. String? sendToken,
    16. String? sendAmount,
    17. String? address,
    18. String? project_id,
    19. String? cursor,
    )?, {
  2. 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? 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,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _CoreEventProperties() when $default != null:
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);case _:
  return orElse();

}
}