invokeAsync0<T> function

Future<T> invokeAsync0<T>(
  1. void function(
    1. void (
      1. Object?,
      2. T
      )
    )
)

Invokes a zero-argument Node.js-style asynchronous function and encapsulates the result in a Future.

Implementation

Future<T> invokeAsync0<T>(void Function(void Function(Object?, T)) function) {
  var completer = Completer<T>();
  function(callbackToCompleter(completer));
  return completer.future;
}