whenOrNull<TResult extends Object?> method

  1. @optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>(
  1. TResult? $default(
    1. int? queueCount,
    2. int? queueIndex,
    3. String? queueSeed,
    4. bool? includeAllUserRecords,
    5. String? subject,
    6. String? comment,
    7. DateTime? reportedAfter,
    8. DateTime? reportedBefore,
    9. DateTime? reviewedAfter,
    10. DateTime? hostingDeletedAfter,
    11. DateTime? hostingDeletedBefore,
    12. DateTime? hostingUpdatedAfter,
    13. DateTime? hostingUpdatedBefore,
    14. List<String>? hostingStatuses,
    15. DateTime? reviewedBefore,
    16. bool? includeMuted,
    17. bool? onlyMuted,
    18. String? reviewState,
    19. List<String>? ignoreSubjects,
    20. String? lastReviewedBy,
    21. String sortField,
    22. String sortDirection,
    23. bool? takendown,
    24. bool? appealed,
    25. int limit,
    26. List<String>? tags,
    27. List<String>? excludeTags,
    28. String? cursor,
    29. List<String>? collections,
    30. ModerationQueryStatusesSubjectType? subjectType,
    31. int? minAccountSuspendCount,
    32. int? minReportedRecordsCount,
    33. int? minTakendownRecordsCount,
    34. int? minPriorityScore,
    35. ModerationQueryStatusesAgeAssuranceState? ageAssuranceState,
    36. Map<String, dynamic>? $unknown,
    )?
)

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( int? queueCount,  int? queueIndex,  String? queueSeed,  bool? includeAllUserRecords,  String? subject,  String? comment,  DateTime? reportedAfter,  DateTime? reportedBefore,  DateTime? reviewedAfter,  DateTime? hostingDeletedAfter,  DateTime? hostingDeletedBefore,  DateTime? hostingUpdatedAfter,  DateTime? hostingUpdatedBefore,  List<String>? hostingStatuses,  DateTime? reviewedBefore,  bool? includeMuted,  bool? onlyMuted,  String? reviewState,  List<String>? ignoreSubjects,  String? lastReviewedBy,  String sortField,  String sortDirection,  bool? takendown,  bool? appealed,  int limit,  List<String>? tags,  List<String>? excludeTags,  String? cursor,  List<String>? collections, @ModerationQueryStatusesSubjectTypeConverter()  ModerationQueryStatusesSubjectType? subjectType,  int? minAccountSuspendCount,  int? minReportedRecordsCount,  int? minTakendownRecordsCount,  int? minPriorityScore, @ModerationQueryStatusesAgeAssuranceStateConverter()  ModerationQueryStatusesAgeAssuranceState? ageAssuranceState,  Map<String, dynamic>? $unknown)?  $default,) {final _that = this;
switch (_that) {
case _ModerationQueryStatusesInput() when $default != null:
return $default(_that.queueCount,_that.queueIndex,_that.queueSeed,_that.includeAllUserRecords,_that.subject,_that.comment,_that.reportedAfter,_that.reportedBefore,_that.reviewedAfter,_that.hostingDeletedAfter,_that.hostingDeletedBefore,_that.hostingUpdatedAfter,_that.hostingUpdatedBefore,_that.hostingStatuses,_that.reviewedBefore,_that.includeMuted,_that.onlyMuted,_that.reviewState,_that.ignoreSubjects,_that.lastReviewedBy,_that.sortField,_that.sortDirection,_that.takendown,_that.appealed,_that.limit,_that.tags,_that.excludeTags,_that.cursor,_that.collections,_that.subjectType,_that.minAccountSuspendCount,_that.minReportedRecordsCount,_that.minTakendownRecordsCount,_that.minPriorityScore,_that.ageAssuranceState,_that.$unknown);case _:
  return null;

}
}