Tasks mixin

Tasks mixin provides an easy way to sequence async work Eg: ... enqueue(() async { await Future.delayed(Duration(seconds: 10)); print('10 secs'); }); enqueue(() async { await Future.delayed(Duration(seconds: 10)); print('1 sec'); }); Output: 10 secs 1 sec

Mixin Applications

Properties

hashCode int
The hash code for this object.
no setterinherited
runningTasks int
Concurrently running tasks count
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelTasks() → void
Cancels all enqueued tasks
disposeTasks() → void
enqueue(TaskDelegate task) Future<void>
Enqueues task for execution and return the completion future Throws: TaskCancelledException
enqueueCancellable(CancellableTaskDelegate task) Future<void>
Enqueues task for execution and return the completion future Also provides the CancellationToken to the closure Throws: TaskCancelledException
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
waitIdle() Future<void>
Provides a future that will complete when the current queue completes Throws: TaskCancelledException

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

scheduled(VoidCallback callback) VoidCallback