armResumeWatchdog function
Timer
armResumeWatchdog({
- required StreamController<
int> progress, - required void onTimeout(),
- Duration timeout = kResumeWatchdog,
Returns a Timer that fires onTimeout after timeout unless cancelled.
The download loop cancels it when the next progress/status event arrives, and
wires onTimeout to close progress with a network error + cancel the
listener, so a silently-dead post-resume task can never hang forever.
Implementation
@visibleForTesting
Timer armResumeWatchdog({
required StreamController<int> progress,
required void Function() onTimeout,
Duration timeout = kResumeWatchdog,
}) {
return Timer(timeout, onTimeout);
}