UpChunk class

Constructors

UpChunk({required String endPoint, required XFile file, Map<String, String> headers = const {}, int chunkSize = 5120, int attempts = 5, int delayBeforeAttempt = 1, void onOnline()?, void onOffline()?, void onAttempt(int chunkNumber, int chunkSize)?, void onAttemptFailure(String message, int chunkNumber, int attemptsLeft)?, void onError(String message, int chunk, int attempts)?, void onSuccess()?, void onProgress(double progress)?, String? connectionCheckEndpoint, int? chunkStart})
Internal constructor used by createUpload

Properties

attempts int
The number of times to retry any given chunk.
final
chunkSize int
The size in kb of the chunks to split the file into, with the exception of the final chunk which may be smaller. This parameter should be in multiples of 64
final
connectionCheckEndpoint String?
Endpoint to check internet connection if connectionCheckEndpoint is null it defaults to the host in endPoint
final
delayBeforeAttempt int
Number of seconds to wait before a retry is fired
final
endPoint String
Upload url as String, required
final
file XFile
XFile to upload, required
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
A Map with any headers you'd like included with the PUT request for each chunk.
final
onAttempt → (void Function(int chunkNumber, int chunkSize)?)
Fired immediately before a chunk upload is attempted.
final
onAttemptFailure → (void Function(String message, int chunkNumber, int attemptsLeft)?)
Fired when an attempt to upload a chunk fails.
final
onError → (void Function(String message, int chunk, int attempts)?)
Fired when a chunk has reached the max number of retries or the response code is fatal and implies that retries should not be attempted.
final
onOffline → (void Function()?)
Fired when the client has gone offline.
final
onOnline → (void Function()?)
Fired when the client has gone online.
final
onProgress → (void Function(double progress)?)
Fired continuously with incremental upload progress. This returns the current percentage of the file that's been uploaded.
final
onSuccess → (void Function()?)
Fired when the upload is finished successfully.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
successfulChunkUploadCodes List<int>
HTTP response codes implying the PUT method has been successful
final
temporaryErrorCodes List<int>
HTTP response codes implying a chunk may be retried
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
It pauses the upload, the _chunk currently being uploaded will finish first before pausing the next _chunk
restart() → void
Restarts the upload after if the upload failed and came to a complete stop
resume() → void
It resumes the upload for the next _chunk
stop() → void
toString() String
A string representation of this object.
inherited

Operators

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