maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- int? id,
- String? nodeId,
- int? number,
- String? state,
- String? title,
- String? body,
- String? mergeCommitSha,
- String? mergeableState,
- String? authorAssociation,
- bool draft,
- bool merged,
- bool mergeable,
- bool rebaseable,
- bool maintainerCanModify,
- int commentsCount,
- int commitsCount,
- int additionsCount,
- int deletionsCount,
- int changedFilesCount,
- int reviewCommentCount,
- GithubRepositoryModelRef? repository,
- GithubUserModelRef? user,
- GithubUserModelRef? mergedBy,
- List<
GithubUserModelRef?> requestedReviewers, - List<
GithubLabelValue> labels, - GithubPullRequestHeadValue? head,
- GithubPullRequestHeadValue? base,
- GithubMilestoneValue? milestone,
- ModelUri? htmlUrl,
- ModelUri? diffUrl,
- ModelUri? patchUrl,
- ModelTimestamp? closedAt,
- ModelTimestamp? mergedAt,
- ModelTimestamp createdAt,
- ModelTimestamp updatedAt,
- bool fromServer,
- 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(
int? id,
String? nodeId,
int? number,
String? state,
String? title,
String? body,
String? mergeCommitSha,
String? mergeableState,
String? authorAssociation,
bool draft,
bool merged,
bool mergeable,
bool rebaseable,
bool maintainerCanModify,
int commentsCount,
int commitsCount,
int additionsCount,
int deletionsCount,
int changedFilesCount,
int reviewCommentCount,
@refParam GithubRepositoryModelRef? repository,
@refParam GithubUserModelRef? user,
@refParam GithubUserModelRef? mergedBy,
@refParam List<GithubUserModelRef> requestedReviewers,
@jsonParam List<GithubLabelValue> labels,
@jsonParam GithubPullRequestHeadValue? head,
@jsonParam GithubPullRequestHeadValue? base,
@jsonParam GithubMilestoneValue? milestone,
ModelUri? htmlUrl,
ModelUri? diffUrl,
ModelUri? patchUrl,
ModelTimestamp? closedAt,
ModelTimestamp? mergedAt,
ModelTimestamp createdAt,
ModelTimestamp updatedAt,
bool fromServer)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _GithubPullRequestModel() when $default != null:
return $default(
_that.id,
_that.nodeId,
_that.number,
_that.state,
_that.title,
_that.body,
_that.mergeCommitSha,
_that.mergeableState,
_that.authorAssociation,
_that.draft,
_that.merged,
_that.mergeable,
_that.rebaseable,
_that.maintainerCanModify,
_that.commentsCount,
_that.commitsCount,
_that.additionsCount,
_that.deletionsCount,
_that.changedFilesCount,
_that.reviewCommentCount,
_that.repository,
_that.user,
_that.mergedBy,
_that.requestedReviewers,
_that.labels,
_that.head,
_that.base,
_that.milestone,
_that.htmlUrl,
_that.diffUrl,
_that.patchUrl,
_that.closedAt,
_that.mergedAt,
_that.createdAt,
_that.updatedAt,
_that.fromServer);
case _:
return orElse();
}
}