Last updated:
0 purchases
queue it
QueueIt #
QueueIt is designed to simplify the process of managing and processing queues in your Flutter and Dart
applications.
Features #
Queue management: Easily add, remove, and process items in a queue.
Event listeners: Listen for updates to the queue and receive snapshots.
Concurrency: Control the number of items processed simultaneously.
Retries: Automatically retry failed items.
Usage #
Here's a basic example of how to use QueueIt:
import 'package:queue_it/queue_it.dart';
void main() {
final queue = QueueIt<int>(
parallel: 1,
retries: 3,
itemHandler: (item) async {
print('Handling item: ${item.id}');
/// Fake processing time
await Future.delayed(Duration(seconds: 1));
})
..onUpdate.listen((snapshot) {
print('Queue updated: ${snapshot.event.name}');
});
/// Add some items to the queue
queue.add(1);
queue.add(2);
queue.add(3);
/// start processing the queue
queue.start();
/// You can continue adding more items to the queue after it starts processing
queue.add(4);
queue.add(5);
}
copied to clipboard
For Flutter projects you will want to use flutter_queue_it, which listens to queue changes and rebuilds your widget tree:
QueueItWidget(
queue: _queue,
builder: (context, snapshot) {
/// `builder` will be called each time the queue updates
final items = _queue.items().toList();
return ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
final item = items[index];
return ListTile(
title: Text('Item status: ${item.status.name}'),
);
},
);
},
);
copied to clipboard
For a more in-depth look at how to use QueueIt, check out the example project.
License #
QueueIt is licensed under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.