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