wasm_run library

A Web Assembly executor for the Dart programming language.

Currently it uses the wasmtime 14.0 or wasmi 0.31 Rust crates for parsing and executing WASM modules. Bindings are created using package:flutter_rust_bridge.

For more information on usage and documentation, please visit the main repository: https://github.com/juancastillo0/wasm_run.

Classes

EnvVariable
ExternalType
FuncTy
GlobalTy
i64
Utility static functions for I64 use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data
MemoryTy
ModuleConfig
ModuleConfigWasmi
ModuleConfigWasmtime
PreopenedDir
A preopened directory that the WASM module will be able to access
TableTy
U8Array16
WasiConfig
The configuration and arguments for the WASI module.
WasiDirectory
A Wasi in-memory directory for the browser executor.
WasiFd
A Wasi file system item One of WasiFile or WasiDirectory.
WasiFile
A Wasi in-memory file for the browser executor.
WasiStackLimits
The configured limits of the Wasm stack.
WasmExternal
A WASM external value that can be imported or exported.
WasmFeatures
https://docs.wasmtime.dev/stability-wasm-proposals-support.html
WasmFunction
A Wasm function.
WasmGlobal
A global value that can be read with get and written with set when the global is mutable.
WasmImport
A WASM import that can be used in WasmInstanceBuilder.addImports to construct a WasmInstance.
WasmInstance
The module instance that was created from a module and can be used to call functions with getFunction or access any of the exports. You can limit the execution of the module with fuel. You may use WasmModule.builder to create a new WasmInstanceBuilder and then WasmInstanceBuilder.build to construct a WasmInstance.
WasmInstanceBuilder
Constructs a new WasmInstance from a WasmModule by adding imports with addImport and constructing other WasmExternal values (createMemory, createGlobal or createTable). You may use WasmModule.builder to create a new WasmInstanceBuilder. To instantiate this builder you may use WasmInstanceBuilder.build or WasmInstanceBuilder.build.
WasmInstanceFuel
Returns the fuel that can be used to limit the amount of computations performed by the instance.
WasmMemory
A linear memory (array of bytes) that can be used to share data with the WASM module.
WasmModule
A compiled WASM module. You may introspect it by using getImports and getExports. You may use builder to create a WasmInstance from it to execute it or use its exports.
WasmModuleExport
WasmModule exports entry.
WasmModuleImport
WasmModule import entry.
WasmRunLibrary
Static namespace for configuring the dynamic library for wasm_run
WasmRuntimeFeatures
WasmSharedMemory
A linear memory (array of bytes) that can be used to share data with the WASM module. This memory can be shared between multiple instances of the same module in different threads.
WasmTable
A Table that can be used to store object references and functions.
WasmValue
A WASM value.
WasmValueRef
A WASM reference value.
WasmWasiFeatures
https://docs.wasmtime.dev/stability-wasi-proposals-support.html
WorkersConfig
Configuration for spawning workers.

Enums

SharedMemoryWaitResult
Result of SharedMemory.atomicWait32 and SharedMemory.atomicWait64
ValueTy
WasmExternalKind
Possible kinds of import or export entries.

Functions

compileWasmModule(Uint8List bytes, {ModuleConfig? config}) Future<WasmModule>
Compiles a Wasm module asynchronously.
compileWasmModuleSync(Uint8List bytes, {ModuleConfig? config}) WasmModule
Compiles a Wasm module synchronously. You should use compileWasmModule, unless the module is small.
wasmRuntimeFeatures() Future<WasmRuntimeFeatures>
Information of the Wasm Runtime. Contains the default and supported WasmFeatures used when compiling a WASM module, the name of the runtime, it's version and whether it is the browser's runtime or not.

Typedefs

I64 = Object
int for dart:io, JsBigInt for dart:html Utility static functions in: i64. use i64.fromInt or i64.fromBigInt to create use i64.toInt or i64.toBigInt to convert use i64.getInt64, i64.getUint64, i64.setInt64 and i64.setUint64 to read bytes data