dio

uploaded files to Azure are corrupted when using dio

谁说我不能喝 提交于 2021-02-08 10:13:17
问题 I'm trying to upload a file from my phone to azure blob storage as a BlockBlob with a SAS. I can get the file to upload, but it can't be opened once downloaded. The file gets corrupted somehow. I thought this was a content-type problem, but I have tried several different approaches to changing to content-type. Nothing has worked so far. My code: FileInfo _fileInfo = await filePicker(); // get the file path and file name // my getUploadInfo fires a call to my backend to get a SAS. // I know

Flutter DIO: upload image using binary body with Dio package

百般思念 提交于 2021-01-27 21:43:35
问题 With thwe http package I can send an image to a server by putting te binary data in the body of a post call like in the snippet of this code: var response = await http.post('My_url', body: File(path).readAsBytesSync(), headers: { 'apikey': 'myAPIKEY', 'Content-Type': 'image/*', // set content-length }); I can't do the same thing by using Dio, I don't know how to put directly the binary data in the body (like i can do it with postman) 回答1: Just putting my solution if someone stumbles upon the

How to adjust download buffer size on flutter http, dio or flutter_downloader?

为君一笑 提交于 2021-01-27 18:12:56
问题 I want to download a large file that is amount of about 300MB . It was a lot slower than I thought, and when I looked at the log, I saw that it was fetching bytes with a size of about 8KB . I haven't found a way to resize the download buffer even if I look for other flutter libraries. How can I adjust that? 回答1: Try using: flutter clean flutter channel stable Flutter has the following channels, in increasing order of stability: master dev beta stable Whenever you faced a strange behavior from

Flutter: Read the Stream data of a BloC state and re-render the UI if it changes

点点圈 提交于 2020-12-13 03:33:00
问题 I have a problem with using the BloC pattern in combination with showing a download process using Dio. Can anybody tell me, how to get the onUploadProgress from dio into a bloc state and display it when the progress inside the state updates? At the moment I have the UI, the BloC and an API class. I need to pass my bloc into the API call to download a file and then add an extra event like so: onReceiveProgress: (int received, int total) => { bloc.add(DownloadingImages((received / total) * 100)

Flutter HTTP request send using xml body

痞子三分冷 提交于 2019-12-24 20:16:01
问题 I'm trying to process a HTTP request in Flutter/Dart (in this case using the SEARCH method to filter some files on a WebDAV server (Nextcloud)) need to send XML data in the body of the request. [x] Can execute the comand using cURL on terminal with the --data parameter: curl -u user:pass -X SEARCH 'https://host123.com.br/remote.php/dav' -H "content-Type: text/xml" --data '<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:basicsearch><d