quantum_upload 1.0.0
quantum_upload: ^1.0.0 copied to clipboard
A pure Dart package for reliable chunked file uploads with automatic resume, persistent session tracking, integrity verification, and seamless recovery from network interruptions.
Changelog #
All notable changes to quantum_upload are documented in this file.
The format follows Keep a Changelog and this project adheres to Semantic Versioning.
1.0.0 β 2026-05-30 #
π Initial stable release #
Added
Core upload engine
Uploaderβ main orchestrator class withstart(),pause(),resume(),cancel(), anddispose().Uploader.upload()β static convenience factory for one-liner usage.stateStreamβ broadcastStream<UploadState>for UI state binding.progressStreamβ broadcastStream<ProgressSnapshot>with speed and ETA.
Chunking
ChunkManagerβ splits files into configurable byte ranges usingRandomAccessFilefor memory-efficient reading.ChunkManager.estimateChunkCount()β static helper for pre-flight UI labels.ChunkManager.lastChunkSize()β static remainder calculator.
Session management
UploadSessionβ full per-chunk state tracking; serialises to/from JSON.UploadSession.restore()β resumes a session from anySessionStorage.- Auto-delete session on successful completion; session survives app kill.
HTTP transport
UploadRequestβ builds and sendsmultipart/form-data POSTwith library headers:X-Session-Id,X-Chunk-Index,X-Total-Chunks,X-Chunk-Checksum,X-File-Size,Content-Range.
Retry logic
RetryPolicyβ exponential back-off:delay_n = baseDelay Γ 2^(nβ1), capped at 30 seconds.RetryPolicy.executeChunk()β HTTP-aware variant that skips retries on 4xx errors (client errors are not transient).
Progress tracking
ProgressTrackerβ EMA-smoothed speed estimate (configurable Ξ±), ETA derivation,ProgressSnapshotstream.ProgressSnapshotβ immutable value object withspeedMbps,etaFormatted,uploadedFormatted,totalFormatted,remainingBytes.
Models
UploadConfigβ immutable, copyable configuration withcopyWith().UploadStateβ 8-value enum with.label,.isActive,.isTerminal,.canResumeextensions.ChunkInfoβ immutable byte-range record with JSON round-trip.UploadResultβ upload summary:speedMbps,sizeMiB,wasFreshUpload,resumedFraction.
Exceptions
UploadExceptionβ base class carryingmessage,sessionId,cause.ChunkExceptionβ addschunkIndex,statusCode,responseBody,isServerError,isClientError,isNetworkError.SessionExceptionβ addsisCorruptflag for version-mismatch detection.
Storage
SessionStorageβ abstract interface for pluggable backends.SharedPrefsStorageβ default implementation usingshared_preferences; includesmigrateFrom()helper.InMemorySessionStorageβ lightweight in-memory implementation for tests.
Tests (100 % coverage)
chunk_manager_test.dartβ 12 test cases covering boundary computation, byte accuracy, checksum correctness, and edge cases.upload_session_test.dartβ 12 test cases covering getters, mutations, save/restore/delete, and corrupt-data handling.retry_policy_test.dartβ 10 test cases covering delay formula, should-retry logic, HTTP-aware executor, and back-off behaviour.progress_tracker_test.dartβ 11 test cases covering percent calculation, stream emissions, speed/ETA, snapshot formatting, and disposal.uploader_test.dartβ 15 end-to-end test cases usingMockHttpClientcovering happy path, retries, state transitions, resume, and cancel.mock_http_client.dartβ fully-featured fake HTTP client with sequence responses, throw-once, fail-then-succeed, and request capture.
Developer tools
example/main.dartβ five runnable examples with terminal progress bar.example/server_example/server.jsβ Node.js reference server with checksum verification, chunk assembly, and session status endpoint.benchmark/upload_benchmark.dartβ measures split time, read throughput, and MD5 hashing throughput across multiple file/chunk size combinations.doc/getting_started.mdβ comprehensive guide with configuration table, resume flow, custom storage, and FAQ.
0.9.0 β 2026-01-01 (beta) #
Added #
- Initial beta implementation for early-access testing.
- Basic chunked upload without session persistence.
- Simple retry loop without exponential back-off.
Known issues (resolved in 1.0.0) #
- Session not persisted across app restarts.
- No progress stream; only callback-based progress.
- Retry delay was constant, not exponential.