invokeAsync1<S, T> function

Future<T> invokeAsync1<S, T>(
  1. void function(
    1. S,
    2. void (
      1. Object?,
      2. T
      )
    ),
  2. S arg1
)

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

Implementation

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