whenOrNull<TResult extends Object?> method
TResult?
whenOrNull<TResult extends Object?>(
- TResult? $default(
- int? id,
- String? name,
- String? fullName,
- GithubUserModelRef? owner,
- GithubOrganizationModelRef? organization,
- String? language,
- GithubLicenseValue? license,
- GithubRepositoryPermissionValue? permissions,
- bool isPrivate,
- bool isFork,
- bool isTemplate,
- String? description,
- String? masterBranch,
- String? mergeCommitMessage,
- String? mergeCommitTitle,
- String? squashMergeCommitMessage,
- String? squashMergeCommitTitle,
- String? nodeId,
- String? tempCloneToken,
- String? visibility,
- List<
String> topics, - bool archived,
- bool disabled,
- bool hasIssues,
- bool hasWiki,
- bool hasDownloads,
- bool hasPages,
- bool hasDiscussions,
- bool hasProjects,
- bool allowAutoMerge,
- bool allowForking,
- bool allowMergeCommit,
- bool allowRebaseMerge,
- bool allowSquashMerge,
- bool allowUpdateBranch,
- bool anonymousAccessEnabled,
- bool deleteBranchOnMerge,
- bool webCommitSignoffRequired,
- int size,
- int stargazersCount,
- int watchersCount,
- int forksCount,
- int openIssuesCount,
- int subscribersCount,
- int networkCount,
- ModelUri? htmlUrl,
- ModelUri? cloneUrl,
- ModelUri? sshUrl,
- ModelUri? svnUrl,
- ModelUri? gitUrl,
- ModelUri? homepageUrl,
- ModelUri? archiveUrl,
- ModelUri? assigneesUrl,
- ModelUri? blobsUrl,
- ModelUri? branchesUrl,
- ModelUri? collaboratorsUrl,
- ModelUri? commentsUrl,
- ModelUri? commitsUrl,
- ModelUri? compareUrl,
- ModelUri? contentsUrl,
- ModelUri? contributorsUrl,
- ModelUri? deploymentsUrl,
- ModelUri? downloadsUrl,
- ModelUri? eventsUrl,
- ModelUri? forksUrl,
- ModelUri? gitCommitsUrl,
- ModelUri? gitRefsUrl,
- ModelUri? gitTagsUrl,
- ModelUri? hooksUrl,
- ModelUri? issueCommentUrl,
- ModelUri? issueEventsUrl,
- ModelUri? issuesUrl,
- ModelUri? keysUrl,
- ModelUri? labelsUrl,
- ModelUri? languagesUrl,
- ModelUri? mergesUrl,
- ModelUri? milestonesUrl,
- ModelUri? mirrorUrl,
- ModelUri? notificationsUrl,
- ModelUri? pullsUrl,
- ModelUri? releasesUrl,
- ModelUri? stargazersUrl,
- ModelUri? statusesUrl,
- ModelUri? subscribersUrl,
- ModelUri? subscriptionUrl,
- ModelUri? tagsUrl,
- ModelUri? teamsUrl,
- ModelUri? treesUrl,
- GithubRepositoryModelRef? templateRepository,
- ModelTimestamp? starredAt,
- ModelTimestamp? pushedAt,
- ModelTimestamp createdAt,
- ModelTimestamp updatedAt,
- bool fromServer,
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? id,
@searchParam String? name,
@searchParam String? fullName,
@refParam GithubUserModelRef owner,
@refParam GithubOrganizationModelRef organization,
@searchParam String? language,
@jsonParam GithubLicenseValue? license,
@jsonParam GithubRepositoryPermissionValue? permissions,
bool isPrivate,
bool isFork,
bool isTemplate,
@searchParam String? description,
String? masterBranch,
String? mergeCommitMessage,
String? mergeCommitTitle,
String? squashMergeCommitMessage,
String? squashMergeCommitTitle,
String? nodeId,
String? tempCloneToken,
String? visibility,
List<String> topics,
bool archived,
bool disabled,
bool hasIssues,
bool hasWiki,
bool hasDownloads,
bool hasPages,
bool hasDiscussions,
bool hasProjects,
bool allowAutoMerge,
bool allowForking,
bool allowMergeCommit,
bool allowRebaseMerge,
bool allowSquashMerge,
bool allowUpdateBranch,
bool anonymousAccessEnabled,
bool deleteBranchOnMerge,
bool webCommitSignoffRequired,
int size,
int stargazersCount,
int watchersCount,
int forksCount,
int openIssuesCount,
int subscribersCount,
int networkCount,
ModelUri? htmlUrl,
ModelUri? cloneUrl,
ModelUri? sshUrl,
ModelUri? svnUrl,
ModelUri? gitUrl,
ModelUri? homepageUrl,
ModelUri? archiveUrl,
ModelUri? assigneesUrl,
ModelUri? blobsUrl,
ModelUri? branchesUrl,
ModelUri? collaboratorsUrl,
ModelUri? commentsUrl,
ModelUri? commitsUrl,
ModelUri? compareUrl,
ModelUri? contentsUrl,
ModelUri? contributorsUrl,
ModelUri? deploymentsUrl,
ModelUri? downloadsUrl,
ModelUri? eventsUrl,
ModelUri? forksUrl,
ModelUri? gitCommitsUrl,
ModelUri? gitRefsUrl,
ModelUri? gitTagsUrl,
ModelUri? hooksUrl,
ModelUri? issueCommentUrl,
ModelUri? issueEventsUrl,
ModelUri? issuesUrl,
ModelUri? keysUrl,
ModelUri? labelsUrl,
ModelUri? languagesUrl,
ModelUri? mergesUrl,
ModelUri? milestonesUrl,
ModelUri? mirrorUrl,
ModelUri? notificationsUrl,
ModelUri? pullsUrl,
ModelUri? releasesUrl,
ModelUri? stargazersUrl,
ModelUri? statusesUrl,
ModelUri? subscribersUrl,
ModelUri? subscriptionUrl,
ModelUri? tagsUrl,
ModelUri? teamsUrl,
ModelUri? treesUrl,
@refParam GithubRepositoryModelRef? templateRepository,
ModelTimestamp? starredAt,
ModelTimestamp? pushedAt,
ModelTimestamp createdAt,
ModelTimestamp updatedAt,
bool fromServer)?
$default,
) {
final _that = this;
switch (_that) {
case _GithubRepositoryModel() when $default != null:
return $default(
_that.id,
_that.name,
_that.fullName,
_that.owner,
_that.organization,
_that.language,
_that.license,
_that.permissions,
_that.isPrivate,
_that.isFork,
_that.isTemplate,
_that.description,
_that.masterBranch,
_that.mergeCommitMessage,
_that.mergeCommitTitle,
_that.squashMergeCommitMessage,
_that.squashMergeCommitTitle,
_that.nodeId,
_that.tempCloneToken,
_that.visibility,
_that.topics,
_that.archived,
_that.disabled,
_that.hasIssues,
_that.hasWiki,
_that.hasDownloads,
_that.hasPages,
_that.hasDiscussions,
_that.hasProjects,
_that.allowAutoMerge,
_that.allowForking,
_that.allowMergeCommit,
_that.allowRebaseMerge,
_that.allowSquashMerge,
_that.allowUpdateBranch,
_that.anonymousAccessEnabled,
_that.deleteBranchOnMerge,
_that.webCommitSignoffRequired,
_that.size,
_that.stargazersCount,
_that.watchersCount,
_that.forksCount,
_that.openIssuesCount,
_that.subscribersCount,
_that.networkCount,
_that.htmlUrl,
_that.cloneUrl,
_that.sshUrl,
_that.svnUrl,
_that.gitUrl,
_that.homepageUrl,
_that.archiveUrl,
_that.assigneesUrl,
_that.blobsUrl,
_that.branchesUrl,
_that.collaboratorsUrl,
_that.commentsUrl,
_that.commitsUrl,
_that.compareUrl,
_that.contentsUrl,
_that.contributorsUrl,
_that.deploymentsUrl,
_that.downloadsUrl,
_that.eventsUrl,
_that.forksUrl,
_that.gitCommitsUrl,
_that.gitRefsUrl,
_that.gitTagsUrl,
_that.hooksUrl,
_that.issueCommentUrl,
_that.issueEventsUrl,
_that.issuesUrl,
_that.keysUrl,
_that.labelsUrl,
_that.languagesUrl,
_that.mergesUrl,
_that.milestonesUrl,
_that.mirrorUrl,
_that.notificationsUrl,
_that.pullsUrl,
_that.releasesUrl,
_that.stargazersUrl,
_that.statusesUrl,
_that.subscribersUrl,
_that.subscriptionUrl,
_that.tagsUrl,
_that.teamsUrl,
_that.treesUrl,
_that.templateRepository,
_that.starredAt,
_that.pushedAt,
_that.createdAt,
_that.updatedAt,
_that.fromServer);
case _:
return null;
}
}