getPreviousRefForPackage static method

Future<String?> getPreviousRefForPackage(
  1. String? root,
  2. String packageName, {
  3. String tagPrefix = 'v',
})

Gets the previous tag ref for a specific package in a workspace Returns null if no tags exist for the package

Implementation

static Future<String?> getPreviousRefForPackage(
  String? root,
  String packageName, {
  String tagPrefix = 'v',
}) async {
  try {
    final tags = await getVersionsForPackage(root, packageName, tagPrefix: tagPrefix);
    if (tags.isEmpty) {
      return null;
    }
    return tags.last.$1;
  } catch (e) {
    logger.detail('Error getting previous ref for package $packageName: $e');
    return null;
  }
}