Completer<T> constructor


Creates a new completer.

The general workflow for creating a new future is to 1) create a new completer, 2) hand out its future, and, at a later point, 3) invoke either complete or completeError.

The completer completes the future asynchronously. That means that callbacks registered on the future are not called immediately when complete or completeError is called. Instead the callbacks are delayed until a later microtask.


var completer = new Completer();
later: {
  completer.complete('completion value');


factory Completer() => new _AsyncCompleter<T>();