`isVoidReturn` should be exposed
gmpassos opened this issue · 1 comments
gmpassos commented
Since the use of the inner
Function
should be allowed, it's important to be able to check if the returned value is void.
juancastillo0 commented
Hi thanks for the issue!
On native platforms you can use the WasmFunction.results.length
to check whether a function returns something.
On web you can use js_util.typeofEquals<dynamic>(result, 'undefined')
to check whether the return is undefined. Before Dart 3.0 I think you need to use the following code for web (in wasm_run we use both methods):
bool isVoidReturn(dynamic value) {
switch (value) {
case null:
return false;
default:
return value == null;
}
}
Although we can could expose it I don't feel it's necessary. But I could be wrong, please let me know if those methods workd for you or if you think we should expose isVoidReturn
.
Thanks