newCallbackWithoutHandle function
Creates a new callback without a handle.
Returns a Callback instance with the specified function type.
Implementation
Callback<CbFuncWithoutHandle> newCallbackWithoutHandle() {
final completer = Completer<AskarCallbackResult>();
late final NativeCallable<CbFuncWithoutHandle> nativeCallable;
void callback(int callbackId, int errorCode) {
completer.complete(AskarCallbackResult(ErrorCode.fromInt(errorCode), true, null));
nativeCallable.close();
}
nativeCallable = NativeCallable<CbFuncWithoutHandle>.listener(callback);
return Callback<CbFuncWithoutHandle>(nativeCallable, completer, nextCallbackId());
}