From fbeae3856a295bbb8426e81a7d2ec94eea980694 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 26 Oct 2020 18:18:59 +0100 Subject: [PATCH] [package_info_plus_web] Fix version.json lookup When creating a new Flutter Web app, the generated index.html contains the following information: The MDN web docs mentioned "document.baseURI", so this patch is using `window.document.baseUri` to get the base URL for version.json. Fix: #26 --- packages/package_info_plus_web/lib/package_info_plus_web.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/package_info_plus_web/lib/package_info_plus_web.dart b/packages/package_info_plus_web/lib/package_info_plus_web.dart index a94c810428..8fbc1fe234 100644 --- a/packages/package_info_plus_web/lib/package_info_plus_web.dart +++ b/packages/package_info_plus_web/lib/package_info_plus_web.dart @@ -17,8 +17,7 @@ class PackageInfoPlugin extends PackageInfoPlatform { @override Future getAll() async { - String url = - "${window.location.protocol}//${window.location.hostname}:${window.location.port}/version.json"; + String url = "${window.document.baseUri}/version.json"; final response = await get(url); if (response.statusCode == 200) {