Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Commit

Permalink
Revert "fix crash when could not find package"
Browse files Browse the repository at this point in the history
This reverts commit a610fa0.
  • Loading branch information
koudle committed Nov 29, 2018
1 parent a610fa0 commit 578d241
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
9 changes: 3 additions & 6 deletions example/src/examples/cow_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,9 @@ class _RemoteMetadataCache {
var c = new Completer<Set<PackageVersion>>();

_versions.putIfAbsent(package, () => new Set());
remote.versions(package)
.where((v) => v != null)
.toList()
.then((versions) {
_versions[package].addAll(versions);
c.complete(_versions[package]);
remote.versions(package).toList().then((versions) {
_versions[package].addAll(versions);
c.complete(_versions[package]);
});

return c;
Expand Down
20 changes: 8 additions & 12 deletions example/src/examples/http_proxy_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ class HttpProxyRepository extends PackageRepository {
baseUrl.resolve('/api/packages/${Uri.encodeComponent(package)}');

http.Response response = await client.get(versionUrl);
if(response.statusCode == 200) {
var json = convert.json.decode(response.body);
var versions = json['versions'] as List<dynamic>;
if (versions != null) {
for (var item in versions) {
var pubspec = item['pubspec'];
var pubspecString = convert.json.encode(pubspec);
yield new PackageVersion(pubspec['name'] as String,
pubspec['version'] as String, pubspecString);
}
var json = convert.json.decode(response.body);
var versions = json['versions'] as List<dynamic>;
if (versions != null) {
for (var item in versions) {
var pubspec = item['pubspec'];
var pubspecString = convert.json.encode(pubspec);
yield new PackageVersion(pubspec['name'] as String,
pubspec['version'] as String, pubspecString);
}
}else{
yield null;
}
}

Expand Down

0 comments on commit 578d241

Please sign in to comment.