Comments (5)
Ok, thanks for the tip.
I tried :
Options options= new Options(
responseType: ResponseType.STREAM
);
Dio dio = new Dio(options);
try {
Response response = await dio.download(
url, outputDirectory + filename, flush: true);
dio.interceptor.response.onError = (DioError e) {
print("error=" + e.message);
};
} on DioError catch (e) {
print("error "+e.message);
}
It does download the file, but is never returning from the download method.
from dio.
Why not use download
API directly ?
from dio.
could you print the response ?
from dio.
I don't believe there was any error, although that was a month ago. I have just used the standard dart mechanism instead.
from dio.
I'm sorry to reply late.
In my local, It works normally, May you need to update the dio to latest version, my test code as follows:
try {
Response response=await dio.download(url,
"./example/flutter.png",
// Listen the download progress.
onProgress: (received, total) {
print((received / total * 100).toStringAsFixed(0) + "%");
}
);
print("xxx");
} catch (e) {
print(e);
}
The xxx
displays in console.
Close first, and open again when there is a problem。
from dio.
Related Issues (20)
- The connection errored: Connection refused This indicates an error which most likely cannot be solved by the library. HOT 1
- [Web] ERROR_TYPE: DioExceptionType.connectionError HOT 2
- Flutter web deployment HOT 1
- [Dio native adapter] proxy HOT 2
- Exception has occurred. DioException (DioException [bad response]: This exception was thrown because the response has a status code of 401 and RequestOptions.validateStatus was configured to throw for this status code. The status code of 401 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled" Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code. ) HOT 1
- error 404 when trying to download a file. HOT 3
- How to mock Dio.interceptors.add when write unit test? HOT 1
- Conditionally allows relative path for `baseUrl` HOT 11
- Need a way to catch DioException [request cancelled] from the caller code HOT 3
- 有没有大佬帮我看看我的代码有什么问题,handler.resolve(res) 后,原始请求返回值一直为空,不知道为什么? HOT 1
- I don't know where the problem is with my code. After handler.reslove(res), the return value of the original request is always empty. HOT 3
- [Flutter Web] dio.get() sends options. HOT 1
- How to use handler.reject in onError of QueuedInterceptor HOT 1
- [native_dio_adapter] Exception fetching LoggerImpl class HOT 4
- http请求头不标准,大小写全部错误 HOT 1
- Error using interceptors HOT 1
- [native_dio_adapter] update cronet_http version HOT 1
- Dio REST call response is slow than Postman HOT 5
- Response Header is missing except content-length & content-type HOT 5
- dio https connect can not keep Alive? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dio.