MiniProgramFileTransferProgress constructor

MiniProgramFileTransferProgress({
  1. required String transferId,
  2. required MiniProgramFileTransferDirection direction,
  3. required MiniProgramFileTransferStatus status,
  4. required int bytesTransferred,
  5. int? totalBytes,
  6. String? fileName,
})

Implementation

MiniProgramFileTransferProgress({
  required String transferId,
  required this.direction,
  required this.status,
  required this.bytesTransferred,
  this.totalBytes,
  String? fileName,
}) : transferId = _requiredFileString(transferId, 'transferId'),
     fileName = _optionalFileString(fileName, 'fileName') {
  if (bytesTransferred < 0) {
    throw const FormatException('bytesTransferred must not be negative.');
  }
  if (totalBytes != null && totalBytes! < 0) {
    throw const FormatException('totalBytes must not be negative.');
  }
  if (totalBytes != null && bytesTransferred > totalBytes!) {
    throw const FormatException('bytesTransferred cannot exceed totalBytes.');
  }
}