Future(dynamic computation())

Creates a future containing the result of calling computation asynchronously with Timer.run.

If the result of executing computation throws, the returned future is completed with the error.

If the returned value is itself a Future, completion of the created future will wait until the returned future completes, and will then complete with the same result.

If a non-future value is returned, the returned future is completed with that value.


factory Future(FutureOr<T> computation()) {
  _Future<T> result = new _Future<T>();
  Timer.run(() {
    try {
    } catch (e, s) {
      _completeWithErrorCallback(result, e, s);
  return result;