durable_queue
1.0.1, released 4 days ago by boffincoders.com
Persistent, retryable task queue for Flutter and Dart that survives crashes and restarts.
WASM-ready
What it does
A durable task queue that handles retries, offline waiting, priorities, dependencies, and recovery. Work is stored as serializable tasks and executed by a worker that owns retries, concurrency, ordering, and crash recovery.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need tasks like photo uploads or edits to survive app crashes and restarts
- You require robust retry policies with backoff, jitter, and offline waiting
- You need multi-step task workflows or deduplication
Skip it when
- You only need simple asynchronous in-memory Futures without persistence
- You want a fully hosted backend task runner
Strengths
- Survives app crashes, restarts, and offline periods
- Supports priorities, dependencies, dead-letter queues, and concurrency limits
- Framework-free core with modular storage and integration packages
Weaknesses
- Requires choosing and configuring a persistent storage adapter for production apps
- Tasks must be fully serializable to JSON
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add durable_queue along with a storage package like durable_queue_sqlite or durable_queue_hive, and register task decoders and handlers on startup.
Future<void> main() async {
final queue = DurableQueue(
storage: MemoryQueueStorage(),
maxConcurrentTasks: 3,
);
queue.register<UploadPhotoTask>(
type: 'upload_photo',
decoder: UploadPhotoTask.fromJson,
handler: (task, context) async {
await photoApi.upload(task.path);
},
);
await queue.start();
await queue.enqueue(
UploadPhotoTask(path: '/storage/avatar.jpg'),
);
}