Closed alvarobcprado closed 2 weeks ago
Hey! thanks for the contribution.
Do you mean when calling fromPlatform
with a file://
scheme, right? e.g. PackageInfo.fromPlatform(baseUrl: 'file://....')
Yes @miquelbeltran , when calling fromPlatform
with a file://
scheme, a Bad state: Origin is only applicable to schemes http and https
error is throwed from baseUri._origin
inside the PackageInfoPlusWebPlugin.versionJsonUrl
method.
/// Get version.json full url.
Uri versionJsonUrl(String baseUrl, int cacheBuster) {
final baseUri = Uri.parse(baseUrl);
final regExp = RegExp(r'[^/]+\.html.*');
final String originPath =
'${baseUri._origin}${baseUri.path.replaceAll(regExp, '')}';
...
extension _UriOrigin on Uri {
/// Get origin.
///
/// This is different from [Uri.origin] because that has checks to prevent
/// non-http/https use-cases.
String get _origin {
if (isScheme('chrome-extension')) {
return '$scheme://$host';
}
return origin;
}
}
Got it! thanks for the clarification
Description
Web apps using file scheme cannot retrieve version.json,
PackageInfoPlusWebPlugin.versionJsonUrl
calls Uri.origin which throwsStateError
if scheme is nothttp
orhttps
Checklist
CHANGELOG.md
nor the plugin version inpubspec.yaml
files.flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
!
in the title as explained in Conventional Commits).