Skip to content
Justice Tech School

Queue and Iterable

Queue from dart:collection works at both ends.

Example
import "dart:collection";
var q = Queue<int>()..add(1)..add(2)..addFirst(0);
print(q);
print(q.removeFirst());
print(q.removeLast());
print(q.length);

Exercise

Add to the front.

q.(0)

Quiz Test

Which library has Queue?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.