whenOrNull<TResult extends Object?> method
- TResult? $default(
- String id,
- String name,
- String? disambiguation,
- List<
String> urls, - String? gender,
- String? birthdate,
- String? ethnicity,
- String? country,
- String? eyeColor,
- int? heightCm,
- String? measurements,
- String? fakeTits,
- double? penisLength,
- String? circumcised,
- String? careerStart,
- String? careerEnd,
- String? tattoos,
- String? piercings,
- List<
String> aliasList, - bool favorite,
- String? imagePath,
- int sceneCount,
- int imageCount,
- int galleryCount,
- int groupCount,
- int? rating100,
- String? details,
- String? deathDate,
- String? hairColor,
- int? weight,
- List<
String> tagIds, - List<
String> tagNames,
A variant of when that fallback to returning null
It is equivalent to doing:
switch (sealedClass) {
case Subclass(:final field):
return ...;
case _:
return null;
}
Implementation
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String? disambiguation, List<String> urls, String? gender, String? birthdate, String? ethnicity, String? country, @JsonKey(name: 'eye_color') String? eyeColor, @JsonKey(name: 'height_cm') int? heightCm, String? measurements, @JsonKey(name: 'fake_tits') String? fakeTits, @JsonKey(name: 'penis_length') double? penisLength, String? circumcised, @JsonKey(name: 'career_start') String? careerStart, @JsonKey(name: 'career_end') String? careerEnd, String? tattoos, String? piercings, @JsonKey(name: 'alias_list') List<String> aliasList, bool favorite, @JsonKey(name: 'image_path') String? imagePath, @JsonKey(name: 'scene_count') int sceneCount, @JsonKey(name: 'image_count') int imageCount, @JsonKey(name: 'gallery_count') int galleryCount, @JsonKey(name: 'group_count') int groupCount, int? rating100, String? details, @JsonKey(name: 'death_date') String? deathDate, @JsonKey(name: 'hair_color') String? hairColor, int? weight, @JsonKey(name: 'tag_ids') List<String> tagIds, @JsonKey(name: 'tag_names') List<String> tagNames)? $default,) {final _that = this;
switch (_that) {
case _Performer() when $default != null:
return $default(_that.id,_that.name,_that.disambiguation,_that.urls,_that.gender,_that.birthdate,_that.ethnicity,_that.country,_that.eyeColor,_that.heightCm,_that.measurements,_that.fakeTits,_that.penisLength,_that.circumcised,_that.careerStart,_that.careerEnd,_that.tattoos,_that.piercings,_that.aliasList,_that.favorite,_that.imagePath,_that.sceneCount,_that.imageCount,_that.galleryCount,_that.groupCount,_that.rating100,_that.details,_that.deathDate,_that.hairColor,_that.weight,_that.tagIds,_that.tagNames);case _:
return null;
}
}