isUpToDate method
Checks whether or not currentVersion
is the latest version
for the package associated with packageName
Implementation
Future<bool> isUpToDate({
required String packageName,
required String currentVersion,
}) async {
final latestVersion = await getLatestVersion(packageName);
final currentVersionDesc = Version.parse(currentVersion);
final latestVersionDesc = Version.parse(latestVersion);
if (!latestVersionDesc.isPreRelease && currentVersionDesc.isPreRelease) {
// If the current version is a pre-release but the latest isn't,
// skip the version checking.
return true;
}
return currentVersion == latestVersion;
}