maybeWhen<TResult extends Object?> method
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 id, String name, String? url, @JsonKey(name: 'image_path') String? imagePath, String? details, int? rating100, @JsonKey(name: 'scene_count') int sceneCount, @JsonKey(name: 'image_count') int imageCount, @JsonKey(name: 'gallery_count') int galleryCount, @JsonKey(name: 'performer_count') int performerCount, bool favorite)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _Studio() when $default != null:
return $default(_that.id,_that.name,_that.url,_that.imagePath,_that.details,_that.rating100,_that.sceneCount,_that.imageCount,_that.galleryCount,_that.performerCount,_that.favorite);case _:
return orElse();
}
}