needsUpdate method

Future<(bool, String)> needsUpdate()

Implementation

Future<(bool, String)> needsUpdate() async {
  final latestVersion = await pubUpdater.getLatestVersion('sip_cli');

  try {
    final semPackageVersion = Version.parse(packageVersion);
    final semLatestVersion = Version.parse(latestVersion);

    logger
      ..detail('Current version: $packageVersion')
      ..detail('Latest version: $latestVersion');

    return (semPackageVersion != semLatestVersion, latestVersion);
  } catch (e) {
    logger
      ..detail('Failed to parse versions')
      ..detail('Error: $e');
    return (false, latestVersion);
  }
}