cvRunAsync1<T> function
Implementation
Future<T> cvRunAsync1<T>(
ffi.Pointer<cvg.CvStatus> Function(cvg.CvCallback_1 callback) func,
void Function(Completer<T> completer, VoidPtr p) onComplete,
) {
final completer = Completer<T>();
late final ffi.NativeCallable<cvg.CvCallback_1Function> ccallback;
void onResponse(VoidPtr p) {
onComplete(completer, p);
ccallback.close();
}
ccallback = ffi.NativeCallable.listener(onResponse);
throwIfFailed(func(ccallback.nativeFunction));
return completer.future;
}