Info
Platform Name: flutter
Platform Version: 1.24.0-8.0.pre356
Dio Version: 3.0.10
Android Studio: 4.1 / Xcode 12.3
Repro rate all the time (100%)
Description and Steps
When making a long request (taking approximately 2 minutes), the Interceptor of the dio returns a DioErrorType.DEFAULT but does not return the reason. Below is the image:
My Dio configuration:
Dio _dio = Dio(BaseOptions(
connectTimeout: 300 * 1000, // 5 minutes to avoid timeout
receiveTimeout: 300 * 1000, // 5 minutes to avoid timeout
));
_dio.interceptors.add(InterceptorsHandler()); // custom Interceptor class
_dio.interceptors.add(LogInterceptor(
responseBody: true,
error: true,
requestHeader: false,
responseHeader: false,
request: false,
requestBody: false));
return _dio;
Print of dioError Object:
DioError (DioError [DioErrorType.DEFAULT]: HttpException: , uri = http:/xxxxxxxxxxxxxxxxxx)
error:HttpException (HttpException: , uri = http://xxxxxxxxxxxxxxx)
message:""
uri:_SimpleUri (http://xxxxxxxxxxxxxxxxxxxx)
hashCode:12237922
runtimeType:Type (HttpException)
request:RequestOptions
baseUrl:""
cancelToken:null
connectTimeout:300000
data:Map (1 item)
extra:Map (0 items)
followRedirects:true
headers:Map (4 items)
maxRedirects:5
method:"POST"
onReceiveProgress:null
onSendProgress:null
path:"http://xxxxxxxxxxxxxxxxxxxxx"
queryParameters:Map (0 items)
receiveDataWhenStatusError:true
receiveTimeout:300000
requestEncoder:null
responseDecoder:null
responseType:ResponseType (ResponseType.json)
_name:"ResponseType.json"
index:0
hashCode:700155926
runtimeType:Type (ResponseType)
sendTimeout:0
validateStatus:Closure: (int) => bool
contentType:"application/json; charset=utf-8"
hashCode:180042835
runtimeType:Type (RequestOptions)
uri:_SimpleUri (http://xxxxxxxxxxxxxxxxxxxx)
response:null
type:DioErrorType (DioErrorType.DEFAULT)
hashCode:956099891
message:"HttpException: , uri = http://xxxxxxxxxxxxxxxxxxxxxxx"
runtimeType:Type (DioError)
EDIT:
After investigating the whole process, I discovered that it was a conflict with my backend timeout (default service timeout) and not a problem with the flutter, in fact.
Changing the server timeout the problem has been solved