remaining method

Duration remaining(
  1. DateTime now
)

Best guess at the time left for this job: the unfinished share of its estimate, so finishing a target (e.g. the AAB of AAB+APK) shortens it.

Implementation

Duration remaining(DateTime now) {
  if (isFinished) return Duration.zero;
  if (state == JobState.queued) return estimate;
  final left = Duration(
      milliseconds: (estimate.inMilliseconds * (1 - fraction(now))).round());
  const floor = Duration(seconds: 5);
  return left > floor ? left : floor;
}