when<TResult extends Object?> method

  1. @optionalTypeArgs
TResult when<TResult extends Object?>(
  1. TResult $default(
    1. String id,
    2. String name,
    3. String homepage,
    4. String imageId,
    5. int order,
    6. String? mobileLink,
    7. String? desktopLink,
    8. String? linkMode,
    9. String? webappLink,
    10. String? appStore,
    11. String? playStore,
    12. String? rdns,
    13. String? chromeStore,
    14. List<Injected>? injected,
    15. List<String>? chains,
    16. List<String>? categories,
    17. String? description,
    18. String? badgeType,
    19. bool? supportsWc,
    20. bool? isTopWallet,
    )
)

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 id,  String name,  String homepage, @JsonKey(name: 'image_id')  String imageId,  int order, @JsonKey(name: 'mobile_link')  String? mobileLink, @JsonKey(name: 'desktop_link')  String? desktopLink, @JsonKey(name: 'link_mode')  String? linkMode, @JsonKey(name: 'webapp_link')  String? webappLink, @JsonKey(name: 'app_store')  String? appStore, @JsonKey(name: 'play_store')  String? playStore,  String? rdns, @JsonKey(name: 'chrome_store')  String? chromeStore,  List<Injected>? injected,  List<String>? chains,  List<String>? categories,  String? description, @JsonKey(name: 'badge_type')  String? badgeType, @JsonKey(name: 'supports_wc')  bool? supportsWc, @JsonKey(name: 'is_top_wallet')  bool? isTopWallet)  $default,) {final _that = this;
switch (_that) {
case _AppKitModalWalletListing():
return $default(_that.id,_that.name,_that.homepage,_that.imageId,_that.order,_that.mobileLink,_that.desktopLink,_that.linkMode,_that.webappLink,_that.appStore,_that.playStore,_that.rdns,_that.chromeStore,_that.injected,_that.chains,_that.categories,_that.description,_that.badgeType,_that.supportsWc,_that.isTopWallet);}
}