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

Unsupported operation: Unsupport download API in browser #573

Closed
zenkog opened this issue Nov 23, 2019 · 12 comments
Closed

Unsupported operation: Unsupport download API in browser #573

zenkog opened this issue Nov 23, 2019 · 12 comments

Comments

@zenkog
Copy link

zenkog commented Nov 23, 2019

My project is using Flutter Web. It's not for production but we need the functionality for something else..
However, I got an exception caught when I used .downloaded method:
"Unsupported operation: Unsupport download API in browser"

The code I wrote is like this:

void downloadImage() async {
Dio dio = Dio();
String urlTest = 'some url string';
try {
await dio.download(urlTest, './testPic123.png'); //trying to save in local directory of my own computer
print('Success!');
} catch (error) {
print(error);
}
}

Its just a simple code

I'm using Dio version 3.0.6

Here is my Flutter doctor:

[✓] Flutter (Channel dev, v1.12.2, on Mac OS X 10.14.6 18G95, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.40.1)
[✓] Connected device (3 available)

• No issues found!

I don't know if these next information is relevant but I also have disabled CORS by adding this to my http.conf: Access-Control-Allow-Origin "*"
Moreover, this is my httpd -v

Server version: Apache/2.4.34 (Unix)
Server built: Feb 22 2019 20:20:11

I'm using MacBook Pro with Mojave OS ver 10.14.6

Any clue??

Thank you everyone!

@stale
Copy link

stale bot commented Dec 23, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

@stale stale bot added the stale label Dec 23, 2019
@stale stale bot closed this as completed Dec 30, 2019
@mahmoudsalah37
Copy link

mahmoudsalah37 commented Jan 24, 2020

i have the save error:
import 'package:dio/dio.dart as dio;
dio.Response response = await dio.Dio()
.download("https://www.google.com/", "./xx.html");
print(response.data.toString());

errror:
js_helper.dart:1342 Uncaught Unsupported operation: Unsupport download API in browser
at Object.f (http://localhost:55140/main.dart.js:1876:3)
at http://localhost:55140/main.dart.js:27340:37
at a30.a (http://localhost:55140/main.dart.js:2764:71)
at a30.$2 (http://localhost:55140/main.dart.js:22468:23)
at Object.x (http://localhost:55140/main.dart.js:2751:19)
at Ff.X4 (http://localhost:55140/main.dart.js:27342:10)
at Ff.v2 (http://localhost:55140/main.dart.js:27337:32)
at http://localhost:55140/main.dart.js:29173:14
at a30.a (http://localhost:55140/main.dart.js:2764:71)
at a30.$2 (http://localhost:55140/main.dart.js:22468:23)

@shashwatadi
Copy link

Same for me. Flutter web seems to have some issue :(

@handersonc
Copy link

handersonc commented Mar 23, 2020

I'm getting the same building for web

@aragonet
Copy link

aragonet commented Apr 3, 2020

The same is happening to me. Hope they reopen this issue.

I've solve it using html.window.open(url, ''); if dart:html is available. If not, use dio as usual.

@zenkog
Copy link
Author

zenkog commented Apr 3, 2020

How do I re-open this issue??

@abdullah432
Copy link

If anyone finds a solution then please share it. I'm facing the same problem.

@cbanaspk
Copy link

If anyone finds a solution then please share it. I'm facing the same problem.

Was this ever resolved?

@yunxingyu
Copy link

The same is happening to me
Unsupported operation: Unsupport download API in browser
E/flutter (15503): #0 DioMixin.download (package:dio/src/dio_mixin.dart:362:5)
E/flutter (15503): #1 ObtainM3u8Imp.startDownload (package:app/ui/player/obtainm3u8imp.dart:302:34)

@HaraldRichter
Copy link

Still an issue...
Error: Unsupported operation: download() is not available in the current environment.

@lele9191
Copy link

It seems that still the same. Reopen pls !! :'(

@DanielJaramillo94
Copy link

DanielJaramillo94 commented May 21, 2024

Still incomplete in web right now 😢

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

No branches or pull requests