TransferPlan class

Simple transfer planning model for estimating ETAs and progress.

Available extensions

Constructors

TransferPlan({required ByteConverter totalBytes, required DataRate rate, ByteConverter? transferredBytes, Duration? elapsed})
Creates a new plan for transferring totalBytes at a nominal rate. Optional transferredBytes or elapsed allow seeding the current state.

Properties

elapsed → Duration
Elapsed time; either provided or derived from transferredBytes.
no setter
estimatedTotalDuration → Duration?
Estimated total duration at the effective rate (may be null if paused/zero rate).
no setter
hashCode → int
The hash code for this object.
no setterinherited
percentComplete → double
Progress as percent in 0,100.
no setter
progressFraction → double
Progress as a fraction in 0,1.
no setter
rate → DataRate
Nominal transfer rate. Nominal data rate used for duration estimates.
final
remainingBytes → ByteConverter
Remaining bytes to transfer (never negative).
no setter
remainingDuration → Duration?
Estimated remaining duration (may be null if paused/zero rate).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalBytes → ByteConverter
Total payload to be transferred.
final
transferredBytes → ByteConverter
Bytes transferred so far; either provided or derived from elapsed.
no setter

Methods

addRateWindow(RateWindow window) → void

Available on TransferPlan, provided by the TransferPlanAdvanced extension

Adds a RateWindow to the schedule used to compute effective rate.
clearSchedule() → void

Available on TransferPlan, provided by the TransferPlanAdvanced extension

Removes all scheduled rate windows.
copyWith({ByteConverter? total, DataRate? rate, ByteConverter? transferred, Duration? elapsed}) → TransferPlan
Returns a new plan with selected fields replaced.
estimatedTotalDurationWithOverhead(double overheadFraction) → Duration?

Available on TransferPlan, provided by the TransferPlanOverhead extension

Estimated total duration considering a simple overhead fraction.
etaString({String pending = 'pending', String done = 'done'}) → String
Humanized ETA string. Returns pending if unknown, done if complete.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void

Available on TransferPlan, provided by the TransferPlanAdvanced extension

Pauses the plan; effective rate becomes zero.
remainingDurationWithOverhead(double overheadFraction) → Duration?

Available on TransferPlan, provided by the TransferPlanOverhead extension

Estimated remaining duration considering a simple overhead fraction.
resume() → void

Available on TransferPlan, provided by the TransferPlanAdvanced extension

Resumes the plan after a pause.
setThrottle(double factor) → void

Available on TransferPlan, provided by the TransferPlanAdvanced extension

Applies a multiplicative throttle factor in 0,1 to the effective rate.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited