FetchProgress class

Passed to the progress method to indicate the current progress of a download.

Constructors

FetchProgress.complete(FetchUrl fetch, int length, int downloaded, {required FetchProgress? prior})
Fetch completed downloading the file
FetchProgress.connected(FetchUrl fetch, {required FetchProgress? prior})
Fetch connected
FetchProgress.connecting(FetchUrl fetch, {required FetchProgress? prior})
Fetch is connecting
FetchProgress.downloading(FetchUrl fetch, int length, int downloaded, {required FetchProgress? prior})
Fetch is downloading. You will get multiples of this event.
FetchProgress.error(FetchUrl fetch, {required FetchProgress? prior})
An error occured whilst downloading the file.
FetchProgress.forHeaders(FetchUrl fetch, Map<String, List<String>>? headers, {required FetchProgress? prior})
Fech has retrieved the HTTP headers
FetchProgress.initialising(FetchUrl fetch)
Fetch is preparing to connect
FetchProgress.response(FetchUrl fetch, int? responseCode, {required FetchProgress? prior})
Fetch has recieved the HTTP response code

Properties

downloaded int
The number of bytes downloaded so far.
final
fetch FetchUrl
Details of the url that is being fetched
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, List<String>>?
When the FetchStatus.headers event is sent this will contain the headers. At all other times it will be null.
final
length int
The length (in bytes) of the file being downloaded. This isn't set until we get the initial response. In some cases it still won't be set if the remote server doesn't respond with a length.
final
prior FetchProgress?
The prior FetchProgress. This is provided so you can compare the start between the existing and prior state which may be useful when outputting progress messages.
getter/setter pair
progress double
a value from 0.0 to 1.0 indicating the percentage progress. You are guarneteed to get a final progress event with a value of 1.0
final
responseCode int?
When the FetchStatus.response event is recieved this value will containe the response code.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status FetchStatus
The current status of the downloader.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

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

Static Methods

formatByteLine(FetchProgress progress) → _ProgressByteUpdate
Formatter for showBytes
show(FetchProgress progress, {String format(FetchProgress progress)?}) → void
Shows the progress by overwritting the existing console line with the string returned from format. Once the download is complete a final newline will be sent to the console so that subsequent output from your script will go on a separate line.
showBytes(FetchProgress progress) → void
Shows the progress by replacing the console existing line with the message: