Reputation: 1052
Is there any way to multi-part upload file to the server for Flutter Web natively. Because there so many ways to do it for flutter iOS and Android.
Upvotes: 3
Views: 3934
Reputation: 77
For Android/IOS we are using:
multiPFile = await MultipartFile.fromFile(file.path,
filename: file.name, contentType: MediaType.parse(mimeType));
For Web you need to build a MultiPartFile from the bytes of the file:
multiPFile = await MultipartFile.fromBytes(file.bytes,
filename: file.name, contentType: MediaType.parse(mimeType));
Upvotes: 4