newCallbackWithInt8 function

Callback<CbFuncWithInt8> newCallbackWithInt8()

Creates a new callback with an Int8 value.

Returns a Callback instance with the specified function type.

Implementation

Callback<CbFuncWithInt8> newCallbackWithInt8() {
  final completer = Completer<AskarCallbackResult>();

  late final NativeCallable<CbFuncWithInt8> nativeCallable;

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

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

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