newCallbackWithInt64 function

Callback<CbFuncWithInt64> newCallbackWithInt64()

Creates a new callback with an Int64 value.

Returns a Callback instance with the specified function type.

Implementation

Callback<CbFuncWithInt64> newCallbackWithInt64() {
  final completer = Completer<AskarCallbackResult>();

  late final NativeCallable<CbFuncWithInt64> nativeCallable;

  void callback(int callbackId, int errorCode, int handle) {
    completer.complete(AskarCallbackResult(ErrorCode.fromInt(errorCode), true, handle));
    nativeCallable.close();
  }

  nativeCallable = NativeCallable<CbFuncWithInt64>.listener(callback);

  return Callback<CbFuncWithInt64>(nativeCallable, completer, nextCallbackId());
}