checkForNewVersion method
Checks for a new version of the given package and returns the new version if available.
packageName is the name of the package to check for updates.
currentVersion is the current version of the package.
type is the type of update to check for (major, minor, or patch). Defaults to minor.
Implementation
Future<Version?> checkForNewVersion(
String packageName,
Version currentVersion, {
Types type = Types.minor,
Version? newVersion,
}) async {
newVersion ??= await getLatestVersion(packageName);
final hasUpdate = compareVersions(currentVersion, newVersion, type);
return hasUpdate;
}