[TC-APP-RELEASE-5] HTTP-Request Timeouts should be handled gracefully
Problem
When requesting http-data from anywhere in the app, one might encounter a TimeoutException. As preparation for the upcoming Offline/Guest Modes we might want to discuss the following points:
- Global TimeoutDuration for http-Requests?
- Set a global state for the NetworkConnectionStatus, if yes when and how often do we check for changes?
- Do we want to retry the failed requests, and if yes when and how often?
Stacktrace
TimeoutException: TimeoutException after 0:00:03.000000: Future not completed
File "token_repository.dart", line 115, in TokenRepository._fetchNewToken
File "<asynchronous suspension>"
File "token_repository.dart", line 88, in TokenRepository.refreshToken
File "<asynchronous suspension>"
File "auth_event.dart", line 27, in AppStartedEvent._performAction
File "<asynchronous suspension>"
File "auth_bloc.dart", line 62, in AuthBloc._runCriticalActions
File "auth_bloc.dart", line 55, in AuthBloc.mapEventToState
File "<asynchronous suspension>"
File "bloc.dart", line 155, in Bloc._bindStateSubject.<fn>
File "stream.dart", line 576, in Stream.asyncExpand.onListen.<fn>
File "zone.dart", line 1134, in _rootRunUnary
File "zone.dart", line 1031, in _CustomZone.runUnary
File "zone.dart", line 933, in _CustomZone.runUnaryGuarded
File "stream_impl.dart", line 338, in _BufferingStreamSubscription._sendData
File "stream_impl.dart", line 593, in _DelayedData.perform
File "stream_impl.dart", line 709, in _StreamImplEvents.handleNext
File "stream_impl.dart", line 669, in _PendingEvents.schedule.<fn>
File "zone.dart", line 1122, in _rootRun
File "zone.dart", line 1023, in _CustomZone.run
File "zone.dart", line 925, in _CustomZone.runGuarded
File "zone.dart", line 965, in _CustomZone.bindCallbackGuarded.<fn>
File "zone.dart", line 1126, in _rootRun
File "zone.dart", line 1023, in _CustomZone.run
File "zone.dart", line 925, in _CustomZone.runGuarded
File "zone.dart", line 965, in _CustomZone.bindCallbackGuarded.<fn>
File "schedule_microtask.dart", line 43, in _microtaskLoop
File "schedule_microtask.dart", line 52, in _startMicrotaskLoop
Edited by Robert Palm