Instance class

Instantiated WebAssembly module.

An Instance can be compiled and instantiated from Uint8List or ByteBuffer source data, or from already compiled Module. When data length exceeds 4 KB, some runtimes may require asynchronous compilation and instantiation via Instance.fromBufferAsync, Instance.fromBytesAsync, or Instance.fromModuleAsync.

Annotations

Constructors

Instance.fromModule(Module module, {Map<String, Map<String, Object>>? importMap, Object? importObject})
Synchronously instantiates compiled WebAssembly Module.
factory

Properties

exports Object
A JsObject representing instantiated module's exports.
no setter
functions Map<String, Function>
An unmodifiable Map view of instantiated module's exported functions.
no setter
globals Map<String, Global>
An unmodifiable Map view of instantiated module's exported globals.
no setter
hashCode int
The hash code for this object.
no setterinherited
jsObject → _Instance
JavaScript WebAssembly.Instance object
final
memories Map<String, Memory>
An unmodifiable Map view of instantiated module's exported memories.
no setter
module Module
WebAssembly Module this instance was instantiated from.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tables Map<String, Table>
An unmodifiable Map view of instantiated module's exported tables.
no setter

Methods

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

fromBufferAsync(ByteBuffer buffer, {Map<String, Map<String, Object>>? importMap, Object? importObject}) Future<Instance>
Asynchronously compiles WebAssembly Module from ByteBuffer source and instantiates it with imports.
fromBytesAsync(Uint8List bytes, {Map<String, Map<String, Object>>? importMap, Object? importObject}) Future<Instance>
Asynchronously compiles WebAssembly Module from Uint8List source and instantiates it with imports.
fromModuleAsync(Module module, {Map<String, Map<String, Object>>? importMap, Object? importObject}) Future<Instance>
Asynchronously instantiates compiled WebAssembly Module with imports.