781flyingdutchman / background_downloader

Flutter plugin for file downloads and uploads
Other
165 stars 76 forks source link

Migrate from dart:html library to package web #314

Closed san-smith closed 6 months ago

781flyingdutchman commented 6 months ago

Hi, what is the reason I would want to do this migration?

san-smith commented 6 months ago

Hi, this is necessary to support Wasm in Flutter apps: https://docs.flutter.dev/platform-integration/web/wasm

781flyingdutchman commented 6 months ago

OK, I was not aware of that. I am curious though: background_downloader does not support the Web as a target. It compiles (to prevent compilation errors for web apps) but it does not work: all methods of the "DesktopDownloader" in file web_downloader.dart throw UnImplementedErrors. So, how did you test the code you modified? You may want to bring your suggested changes to the author of the local_store package, who would benefit from this.

Another question: will this break things for people who are using the current (unmodified) version that uses dart:html? Again, it won't work on the web but I don't want the compilation to break for them either.

dkrutskikh commented 6 months ago

@781flyingdutchman I have similar than @san-smith situation. We develop cross-platform application which runs on Android/iOS and PWA. We use background downloader for download on native platforms. I think this changes need to publish new major version because they need to raise minimum sdk version.

781flyingdutchman commented 6 months ago

Changing minSdk is not a breaking change but I do want to know if this breaks things for developers who either don't upgrade to new flutter version or do upgrade but don't want to change anything else in their app

781flyingdutchman commented 6 months ago

OK, simpler approach is to throw UnimplementedError for every required member of the UtilsImpl interface, and remove the import statement. No need for a dependency on package web.

Included in V8.5.2. Thanks for bringing this to my attention.