-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
MultipartFile is only supported where dart:io is available #1067
Comments
I'm using flutter v2.2 and getting the same issue the exception is occurring when trying to get MultipartFile from bytes and this is the chunk of the code that is throwing the exception
|
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. |
still, I don't get a real fix for this problem, anyone can help me? |
Still, i dont get a real fix for this problem :(. |
Has anyone got fix on this one? |
1 similar comment
Has anyone got fix on this one? |
I was having same issue, but I had solved them but not using dio. Since most of you here want to upload file, I think I better share something. So for anyone that want to upload file using flutter 2.2 web, I suggest you to follow my step, late String base64file; final fileInput = html.document.createElement('input') as html.InputElement fileInput.onChange.listen((event) { getArrayBuffer(_file, done){ getBase64(_file, done){ MaterialButton(child: Text("Submit"), onPressed: ()=>postFileToStrapi(base64file, fileBytes, fileName)), In the second file: ` import 'dart:convert'; void postFileToStrapi(base64file, fileBytes, fileName){ PickedFile imageFile = PickedFile(base64file); var uri = Uri.parse(url); request.files.add(multipartFile); |
I continue with the same issue "MultipartFile is only supported where dart:io is available". Flutter 2.10.0 and Dart 2.16.0 |
It should be work:
|
Nope! |
this will do the job:
thanks to isuru for: https://stackoverflow.com/a/75825712/6466343 |
New Issue Checklist
Web Build
Flutter 1.27.0-8.0.pre • channel dev • https://github.com/flutter/flutter.git
Framework • revision b7d4806243 (13 days ago) • 2021-02-19 09:22:45 -0800
Engine • revision 6993cb229b
Tools • Dart 2.13.0 (build 2.13.0-30.0.dev)
Issue Description and Steps
I am using the cloudinary package on web, which is in-turn using Dio to call
toMultipartFile
This is causing an exception at runtime:
There is some discussion here with some proposed fix:
https://stackoverflow.com/questions/63314063/upload-image-file-to-strapi-flutter-web
The text was updated successfully, but these errors were encountered: