Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get script url using flutter utility #65

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

p-mazhnik
Copy link
Contributor

In Flutter it is possible to customize the location that assets will be loaded from (e.g. using assetBase meta tag or providing this property to engine initializer directly)
Current solution assumes that script is always under <rootUrl>/assets/ directory, which is not true if assetBase is used. So in the current PR I use getAssetUrl utility provided by Flutter that respects assetBase

https://github.com/flutter/engine/blob/942909b77001b4904e26aa29e3cac63345108a0a/lib/web_ui/lib/ui_web/src/ui_web/asset_manager.dart#L76-L81

@deakjahn
Copy link
Owner

deakjahn commented Jul 7, 2023

The pubspec.yaml has a specific reference to the asset file. Do you think this has any influence on this issue?

@p-mazhnik
Copy link
Contributor Author

No, this is only to locate asset within the package:
pathInPackage = packages/flutter_dropzone_web/assets/flutter_dropzone.js.

Current issue is that code assumes that url for this asset within the app will be
assets/ + $pathInPackage = assets/packages/flutter_dropzone_web/assets/flutter_dropzone.js, which is not always true, because it can be $assetBase + assets/ + $pathInPackage. That is what getAssetUrl utility is for:

getAssetUrl(pathInPackage) => $assetBase + $assetsDirectory + $pathInPackage

@deakjahn deakjahn merged commit 5fe86a9 into deakjahn:master Jul 7, 2023
@deakjahn
Copy link
Owner

deakjahn commented Jul 7, 2023

Let's see, thanks.

@p-mazhnik p-mazhnik deleted the url-fix branch July 8, 2023 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants