maybeWhen<TResult extends Object?> method
TResult
maybeWhen<TResult extends Object?>(
- TResult $default(
- int? id,
- int? number,
- String? title,
- String? body,
- String? bodyHtml,
- String? bodyText,
- String? state,
- String? stateReason,
- String? activeLockReason,
- String? authorAssociation,
- String? nodeId,
- bool draft,
- bool locked,
- int commentsCount,
- GithubRepositoryModelRef? repository,
- GithubUserModel? user,
- GithubUserModel? assignee,
- List<
GithubUserModel> assignees, - GithubUserModel? closedBy,
- List<
GithubLabelValue> labels, - ModelUri? url,
- ModelUri? htmlUrl,
- ModelUri? commentsUrl,
- ModelUri? eventsUrl,
- ModelUri? labelsUrl,
- ModelUri? repositoryUrl,
- ModelUri? timelineUrl,
- GithubReactionValue? reactions,
- ModelTimestamp? closedAt,
- 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,
int? number,
String? title,
String? body,
String? bodyHtml,
String? bodyText,
String? state,
String? stateReason,
String? activeLockReason,
String? authorAssociation,
String? nodeId,
bool draft,
bool locked,
int commentsCount,
@refParam GithubRepositoryModelRef? repository,
@jsonParam GithubUserModel? user,
@jsonParam GithubUserModel? assignee,
@jsonParam List<GithubUserModel> assignees,
@jsonParam GithubUserModel? closedBy,
@jsonParam List<GithubLabelValue> labels,
ModelUri? url,
ModelUri? htmlUrl,
ModelUri? commentsUrl,
ModelUri? eventsUrl,
ModelUri? labelsUrl,
ModelUri? repositoryUrl,
ModelUri? timelineUrl,
@jsonParam GithubReactionValue? reactions,
ModelTimestamp? closedAt,
ModelTimestamp createdAt,
ModelTimestamp updatedAt,
bool fromServer)?
$default, {
required TResult orElse(),
}) {
final _that = this;
switch (_that) {
case _GithubIssueModel() when $default != null:
return $default(
_that.id,
_that.number,
_that.title,
_that.body,
_that.bodyHtml,
_that.bodyText,
_that.state,
_that.stateReason,
_that.activeLockReason,
_that.authorAssociation,
_that.nodeId,
_that.draft,
_that.locked,
_that.commentsCount,
_that.repository,
_that.user,
_that.assignee,
_that.assignees,
_that.closedBy,
_that.labels,
_that.url,
_that.htmlUrl,
_that.commentsUrl,
_that.eventsUrl,
_that.labelsUrl,
_that.repositoryUrl,
_that.timelineUrl,
_that.reactions,
_that.closedAt,
_that.createdAt,
_that.updatedAt,
_that.fromServer);
case _:
return orElse();
}
}