queue_it 0.9.0 copy "queue_it: ^0.9.0" to clipboard
queue_it: ^0.9.0 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.

example/lib/main.dart

import 'package:queue_it/queue_it.dart';

void main() {
  final queue = QueueIt<int>(
      parallel: 3,
      retries: 3,
      useFriendlyIds: true,
      itemHandler: (item) async {
        print('Handling item: ${item.id}');

        /// Fake processing time
        await Future.delayed(Duration(seconds: 1));
      })
    ..onUpdate.listen((snapshot) {
      if (snapshot.eventItem != null) {
        print(snapshot.eventItem!.summaryTableLine);
      } else {
        print(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);
}
4
likes
160
points
86
downloads

Publisher

verified publishersharpsan.dev

Weekly Downloads

QueueIt makes dealing with queues easy. You can add multiple listeners, specify the number of concurrent items to process, view queue progress and more.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

uuid

More

Packages that depend on queue_it