getRemoteVersion function

Future<String> getRemoteVersion(
  1. String package
)

获取package的最新版本

Implementation

Future<String> getRemoteVersion(String package) async {
  var res = await get(Uri.parse('$HOST_URL/api/packages/$package'));
  if (res.statusCode == 200) {
    return json.decode(res.body)['latest']['version'];
  } else {
    throw 'Failed to get the latest version of "$package", statusCode: ${res.statusCode}';
  }
}