UpChunk constructor
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()?,
- void onAttemptFailure()?,
- void onError()?,
- void onSuccess()?,
- void onProgress(
- double progress
- String? connectionCheckEndpoint,
- int? chunkStart,
Internal constructor used by createUpload
Implementation
UpChunk({
required this.endPoint,
required this.file,
this.headers = const {},
this.chunkSize = 5120,
this.attempts = 5,
this.delayBeforeAttempt = 1,
this.onOnline,
this.onOffline,
this.onAttempt,
this.onAttemptFailure,
this.onError,
this.onSuccess,
this.onProgress,
this.connectionCheckEndpoint,
int? chunkStart,
}) {
_validateOptions();
_chunkByteSize = chunkSize * 1024;
if (chunkStart != null) {
_chunkCount = chunkStart;
}
// restart sync when back online
// trigger events when offline/back online
var checkEndpoint = connectionCheckEndpoint != null
? connectionCheckEndpoint!
: _endPointUri.origin;
_internetConnection = InternetConnection.createInstance(
customCheckOptions: [
InternetCheckOption(uri: Uri.parse(checkEndpoint)),
],
useDefaultOptions: false,
);
_internetConnection.onStatusChange.listen(_connectionChanged);
_initialize();
}