blocking_queue 0.1.0
blocking_queue: ^0.1.0 copied to clipboard
Dart queues that wait for items, with either FIFO buffering or a buffer that keeps only the latest item.
example/blocking_queue_example.dart
import 'package:blocking_queue/blocking_queue.dart';
Future<void> main() async {
final updates = SingleCapacityBlockingQueue<String>();
final first = updates.dequeue();
updates.enqueue('Starting');
print(await first); // Starting
updates.enqueue('Refreshing');
updates.enqueue('Ready');
print(await updates.dequeue()); // Ready
updates.dispose();
}