Skip to content

Commit abb8248

Browse files
committed
Add LIFO section back to README
1 parent 06e46ef commit abb8248

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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
106123
You can add items to the front of the queue to process them sooner using the `addToFront` parameter:
107124

0 commit comments

Comments
 (0)