checkForUpdate function

Future<void> checkForUpdate()

Implementation

Future<void> checkForUpdate() async {
  // Create an instance of PubUpdater

  // Check whether or not packageVersion is the latest version of asset_manager_cli
  final isUpToDate = await pubUpdater.isUpToDate(
    packageName: 'asset_manager_cli',
    currentVersion: packageVersion,
  );

  // Trigger an upgrade to the latest version if asset_manager_cli is not up to date
  if (!isUpToDate) {
    await pubUpdater.update(packageName: 'asset_manager_cli');
  }
}