queue_it 0.0.1
queue_it: ^0.0.1 copied to clipboard
QueueIt makes dealing with queues easy.
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.
Installation #
To use this library in your project, add it to your pubspec.yaml file:
dependencies:
queue_it: ^0.0.1
Then, run flutter pub get to fetch the package.
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>(
concurrentOperations: 1,
retryLimit: 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.
Documentation #
For more information on how to use QueueIt, including a full API reference, check out the documentation.
Contributing #
We welcome contributions! Please see our contributing guide for more information.
License #
QueueIt is licensed under the MIT License.