downloadPkgSpecs function

Future<List<Map<String, String>>> downloadPkgSpecs (
  1. Set pset
)

Implementation

Future<List<Map<String, String>>> downloadPkgSpecs(Set pset) async {
  // omitting this type decl breaks the code
  var devPubPlugins = List<Map<String, String>>();
  // var fn = () async {
  for (var pkg in pset) {
    var url = 'https://pub.dartlang.org/api/packages/' + pkg + '_dartrix';
    var response = await http.get(url);
    // print(response.body);
    var body = json.decode(response.body);
    // Config.ppLogger.v('name: ${body["name"]}');
    devPubPlugins.add({
      'name': body['name'],
      'version': body['latest']['pubspec']['version'],
      'docstring': body['latest']['pubspec']['docstring'],
      'scope': 'pubdev',
      'docstring': body['latest']['pubspec']['description']
    });
  }
  ;
  // await fn();
  // print(devPubPlugins);
  return devPubPlugins;
}