putData method

UploadTaskForAll putData(
  1. Uint8List data, [
  2. SettableMetadata? metadata
])

Implementation

UploadTaskForAll putData(Uint8List data, [SettableMetadata? metadata]) {
  if (_ref_original != null) {
    UploadTaskForAll task = UploadTaskForAll();
    task.setDownloadingStream = _ref_original!
        .putData(
            data,
            metadata != null
                ? settableMetadataConverterOriginal(metadata)
                : null)
        .snapshotEvents
        .listen((taskSnapshot) {
      task.updateTask(ProcessTask(
          processed: taskSnapshot.bytesTransferred,
          total: taskSnapshot.totalBytes,
          state: taskStateConverterOriginal(taskSnapshot.state)));
    }, onError: (e, stackTrace) {
      task.addError(e, stackTrace);
    });
    return task;
  } else {
    UploadTaskForAll task = UploadTaskForAll();
    task.setDownloadingStream = _ref_windows!
        .putData(
            data,
            metadata != null
                ? settableMetadataConverterWindows(metadata)
                : null)
        .snapshotEvents
        .listen((taskSnapshot) {
      task.updateTask(ProcessTask(
          processed: taskSnapshot.bytesTransferred,
          total: taskSnapshot.totalBytes,
          state: taskStateConverterWindows(taskSnapshot.state)));
    }, onError: (e, stackTrace) {
      task.addError(e, stackTrace);
    });
    return task;
  }
}