shouldAttemptRetryOnResponse method
Defines whether the request should be retried after the request has
received response from the server.
Implementation
@override
Future<bool> shouldAttemptRetryOnResponse(BaseResponse response) async {
try {
//Auth token expired
if (response.statusCode == 401) {
if (_isRefreshing) {
await _completer.future;
return true;
}
final url = response.request?.url;
return refreshToken(url?.toString());
}
} on Exception catch (_) {}
return false;
}