From de8d01455cc09967e972841dc104fd9a4b959acc Mon Sep 17 00:00:00 2001 From: Minsu Lee Date: Tue, 8 Nov 2022 22:12:13 +0900 Subject: [PATCH] feat: change downloadUrl to future (#38) * feat: change downloadUrl to future * feat: change downloadUrl to future --- unpub/lib/src/app.dart | 3 ++- unpub/lib/src/package_store.dart | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/unpub/lib/src/app.dart b/unpub/lib/src/app.dart index 180db9c8..028cbf15 100644 --- a/unpub/lib/src/app.dart +++ b/unpub/lib/src/app.dart @@ -215,7 +215,8 @@ class App { } if (packageStore.supportsDownloadUrl) { - return shelf.Response.found(packageStore.downloadUrl(name, version)); + return shelf.Response.found( + await packageStore.downloadUrl(name, version)); } else { return shelf.Response.ok( packageStore.download(name, version), diff --git a/unpub/lib/src/package_store.dart b/unpub/lib/src/package_store.dart index 26963faa..ed50aa14 100644 --- a/unpub/lib/src/package_store.dart +++ b/unpub/lib/src/package_store.dart @@ -1,7 +1,9 @@ +import 'dart:async'; + abstract class PackageStore { bool supportsDownloadUrl = false; - String downloadUrl(String name, String version) { + FutureOr downloadUrl(String name, String version) { throw 'downloadUri not implemented'; }