queue_it 0.0.3
queue_it: ^0.0.3 copied to clipboard
QueueIt makes dealing with queues easy. You can add multiple listeners, specify the number of concurrent items to process, view queue progress and more.
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 Easy Queue:
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);
}
For a more in-depth look at how to use QueueIt, check out the example project.
License #
QueueIt is licensed under the MIT License.