merge method

PackageHealth merge(
  1. PackageHealth other
)

Returns a merged snapshot using non-null values from other.

Implementation

PackageHealth merge(PackageHealth other) {
  return PackageHealth(
    latestVersion: other.latestVersion ?? latestVersion,
    latestPublishedAt: other.latestPublishedAt ?? latestPublishedAt,
    publisher: other.publisher ?? publisher,
    popularity: other.popularity ?? popularity,
    likes: other.likes ?? likes,
    pubPoints: other.pubPoints ?? pubPoints,
    publishedVersions: other.publishedVersions.isNotEmpty
        ? other.publishedVersions
        : publishedVersions,
    isDiscontinued: isDiscontinued || other.isDiscontinued,
    repositoryUrl: other.repositoryUrl ?? repositoryUrl,
    githubOrg: other.githubOrg ?? githubOrg,
    stars: other.stars ?? stars,
    contributors: other.contributors ?? contributors,
    lastCommitAt: other.lastCommitAt ?? lastCommitAt,
    openIssues: other.openIssues ?? openIssues,
    sdkConstraint: other.sdkConstraint ?? sdkConstraint,
    offline: offline && other.offline,
  );
}