work_db 1.1.0
work_db: ^1.1.0 copied to clipboard
A lightweight, cross-platform local database for Dart and Flutter. Simple key-value storage with collections, supporting Desktop, Web, and Mobile.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.0 - 2026-02-02 #
Added #
- File-based Locking: Introducing
ClientWorkDbLockfor thread-safe concurrent access with automatic lock management- Lock acquisition with
tryAcquire()andtryAcquireThrow()methods - Automatic lock expiration detection (5000ms timeout)
- Stale lock cleanup with configurable timeout (
waitingMsparameter) - Lock information tracking (timestamp and user)
- Windows file lock error handling
- Lock acquisition with
- LockManager: New file-based lock manager implementation
- Lock files stored in parallel
./WorkDBLocksdirectory structure - ISO8601 timestamp-based expiration tracking
- Optional timeout-based stale lock detection
- Simple and timeout modes for flexibility
- Lock files stored in parallel
- LockAcquisitionException: New exception type for lock acquisition failures
- Inheritance-based Architecture: Refactored with
partandpart offor clean code separationClientWorkDb- Base class without locking (for non-concurrent scenarios)ClientWorkDbLock- Extends ClientWorkDb with full locking support- Eliminates null checks and improves maintainability
- Enhanced Testing: Added 22 comprehensive locking tests covering:
- Lock acquisition and release
- Multi-client concurrent access
- Stale lock detection and cleanup
- Lock timeout and expiration
- Error handling and lock recovery
Changed #
ClientWorkDbis now a lightweight base implementation without locking overhead- Users requiring thread-safety should use
ClientWorkDbLockinstead - Internal architecture improved with library-level
partdirectives
Improved #
- Better separation of concerns between locking and non-locking implementations
- More efficient for single-threaded or non-concurrent applications
- Comprehensive documentation for lock management
- 22 new tests ensuring lock correctness across scenarios
1.0.2 - 2026-01-20 #
Added #
- Introduced polymorphic Factory Pattern with dedicated input types (
IoWorkDbFactoryInput,WebWorkDbFactoryInput,MemoryWorkDbFactoryInput) for each implementation. - All examples, tests, and documentation now use the new factory pattern.
- All test suites aligned to the new pattern (202 tests, 100% pass).
Changed #
- Breaking change: All instantiation now requires input objects for factory methods.
- README and examples updated to reflect new usage.
Removed #
- Deprecated old static factory methods (
forIo,forWeb,forMemory,createIo,createWeb,createMemory).
1.0.0 - 2024-12-22 #
Added #
- Initial release
ClientWorkDb- Main database client implementationIoWorkDb- File system storage for Desktop/Server (Windows, macOS, Linux)WebWorkDb- localStorage-based storage for WebMemoryWorkDb- In-memory storage for testingWorkDbFactory- Factory methods for easy instantiation- Full CRUD operations: create, read, update, delete
- Batch operations: createMultiple, retrieveMultiple, createOrUpdateMultiple
- Collection management: getItemsInCollection, getCollections, deleteCollection
- Comprehensive test suite with 33 tests per implementation