fetchLatestArchiveUrl method

Future<Uri> fetchLatestArchiveUrl(
  1. String packageName
)

The archive URL for a package's latest published version.

Implementation

Future<Uri> fetchLatestArchiveUrl(String packageName) async {
  final uri = _baseUri.resolve('/api/packages/$packageName');
  final body = await _getJson(uri);
  final latest = body['latest'] as Map<String, dynamic>;
  return Uri.parse(latest['archive_url'] as String);
}