You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm wrapping my request to an api endpoint using the flutter retry package to retry the call if on socket exception or timeout exception. On timeout the Requests package throws a Timeout Exception that is not caught by the retry package and also in a try catch block it fails. Anyone have an idea why this is not working? Tried setting the timeout to about 20 seconds, same issue.
Future getPlayerElementSummary(int playerId) async {
try {
var playerElementSummaryUrl = baseUrl + '/element-summary/$playerId/';
var cookies =
await Requests.getStoredCookies(Requests.getHostname(loginUrl));
Requests.setStoredCookies(
Requests.getHostname(playerElementSummaryUrl), cookies);
final response = await retry(
() async {
try {
var data = await Requests.get(playerElementSummaryUrl,
headers: head, timeoutSeconds: 20);
return data.json();
} catch (e) {
print(e);
}
},
retryIf: (e) => e is SocketException || e is TimeoutException,
);
return response;
} catch (e) {
print(e);
}
}
Flutter doctor logs
` [√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.50.0)
[√] Connected device (1 available)
• No issues found!`
The text was updated successfully, but these errors were encountered:
I'm wrapping my request to an api endpoint using the flutter retry package to retry the call if on socket exception or timeout exception. On timeout the Requests package throws a Timeout Exception that is not caught by the retry package and also in a try catch block it fails. Anyone have an idea why this is not working? Tried setting the timeout to about 20 seconds, same issue.
Future getPlayerElementSummary(int playerId) async {
try {
var playerElementSummaryUrl = baseUrl + '/element-summary/$playerId/';
var cookies =
await Requests.getStoredCookies(Requests.getHostname(loginUrl));
Requests.setStoredCookies(
Requests.getHostname(playerElementSummaryUrl), cookies);
}
Flutter doctor logs
` [√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18362.900], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.50.0)
[√] Connected device (1 available)
• No issues found!`
The text was updated successfully, but these errors were encountered: