I am using Dio Package and I want to know how can I set timeout because it is taking so long time ?, and I want to understand about Option Class that has (sending timeout, receive Timeout , etc ) ?
Asked
Active
Viewed 2,183 times
0
-
Does this answer your question? [How to handle timeout error with Dio in Flutter?](https://stackoverflow.com/questions/59769939/how-to-handle-timeout-error-with-dio-in-flutter) – Md. Yeasin Sheikh Mar 08 '22 at 06:39
-
no because I don't want handle I asked if I can set timeout mean reduce the waiting of timeout to appear the error and my question also about understanding the Option class @YeasinSheikh – marwan steam Mar 08 '22 at 06:44
1 Answers
1
Here is a Options specification.
https://pub.dev/packages/dio#request-options
And you can just add timeout like below without Options parameter.
final response = await dioClient
.post(
url,
options: Options(headers: config),
data: data,
)
.timeout(Duration(seconds: 3));

KuKu
- 6,654
- 1
- 13
- 25
-
TimeoutException (TimeoutException after 0:00:20.000000: Future not completed) this error this mean that the future function does not complete so this error not type from DioError types @kuku – marwan steam Mar 08 '22 at 06:59