eta property

Duration? get eta

Estimated time to completion based on average. Returns null when the average rate is zero or total is unknown.

Implementation

Duration? get eta {
  final avg = average.bitsPerSecond;
  if (avg <= 0 || total == null) return null;
  final remaining = total!.bytes - transferred.bytes;
  if (remaining <= 0) return Duration.zero;
  final seconds = (remaining * 8.0) / avg;
  return Duration(microseconds: (seconds * 1e6).ceil());
}