retryRequest method
Future<Response?>
retryRequest(
- DioException err
)
Implementation
Future<Response?> retryRequest(DioException err) async {
try {
final options = err.requestOptions;
final newHeaders = Map<String, dynamic>.from(options.headers);
newHeaders["Authorization"] = "Bearer $accessToken";
final newRequest = await dio.request(
options.path,
data: options.data,
queryParameters: options.queryParameters,
options: Options(
method: options.method,
headers: newHeaders,
),
);
return newRequest;
} catch (_) {
return null;
}
}