File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,23 @@ main() async {
102102}
103103```
104104
105+ #### LIFO (Last In First Out)
106+ You can configure the queue to process items in LIFO order (last in, first out) by setting the ` lifo ` parameter:
107+
108+ ``` dart
109+ import 'package:queue/queue.dart';
110+
111+ main() async {
112+ // Create a LIFO queue
113+ final queue = Queue(lifo: true);
114+
115+ // Add items to the queue
116+ queue.add(() => Future.delayed(Duration(milliseconds: 100))); // Will be processed last
117+ queue.add(() => Future.delayed(Duration(milliseconds: 50))); // Will be processed second
118+ queue.add(() => Future.delayed(Duration(milliseconds: 10))); // Will be processed first
119+ }
120+ ```
121+
105122#### Adding items to the front of the queue
106123You can add items to the front of the queue to process them sooner using the ` addToFront ` parameter:
107124
You can’t perform that action at this time.
0 commit comments