pub_updater 0.1.1 pub_updater: ^0.1.1 copied to clipboard
A Dart package which enables checking whether a package is up to date.
import 'package:pub_updater/pub_updater.dart';
Future<void> main() async {
// Initialize an instance of PubUpdater.
final pubUpdater = PubUpdater();
// Check whether a package is up to date.
final isUpToDate = await pubUpdater.isUpToDate(
packageName: 'my_package',
currentVersion: '0.1.0',
);
if (!isUpToDate) {
// Upgrade to the latest version if not up to date.
await pubUpdater.update(packageName: 'my_package');
}
}