toDartValue function

Object? toDartValue(
  1. WasmStore store,
  2. WasmValueKind kind,
  3. Object? value
)

Converts a value read from the C API into the object layer's form.

The value layer represents a funcref as a bare FuncHandle; here it becomes a WasmFunc so that it can be called.

Implementation

Object? toDartValue(WasmStore store, WasmValueKind kind, Object? value) {
  if (kind == WasmValueKind.funcRef && value is FuncHandle) {
    return WasmFunc.fromHandle(store, value);
  }
  return value;
}