EmscriptenModule class

Provides access to WebAssembly compiled with emscripten.

WebAssembly compiled with emscripten comes with an <moduleName>.wasm and an additional <moduleName>.js glue JavaScript file. The later is required to be loaded on the page before calling any of this classes functions.

The WebAssembly must have been compiled with the -s MODULARIZE=1 and -s EXPORT_NAME=<moduleName> flags. Futhermore the <moduleName.js> must contain all exported WebAssembly functions that should be usable from dart, so using -s MAIN_MODULE=1 might be advisable.

For a detailed walkthrough on how to create and inject these files, see the example.

On platforms where dart:js is not available, all methods throw UnsupportedErrors.

Inheritance
Annotations

Properties

exports List<WasmSymbol>
A list containing everything exported by the underlying WebAssembly instance.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
heap ByteBuffer
Provides access to the WebAssemblys memory buffer.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

free(int pointer) → void
Provides access to the free function in WebAssembly.
override
malloc(int size) int
Provides access to the malloc function in WebAssembly.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

compile(Uint8List wasmBinary, String moduleName) Future<EmscriptenModule>
Connects to the JavaScript glue of the emscripten module.
process(String moduleName) Future<EmscriptenModule>
Connects to the JavaScript glue of the emscripten module.