wasm_ffi 2.4.0
wasm_ffi: ^2.4.0 copied to clipboard
A wrapper for wasm which can be used as a drop-in replacement for dart:ffi for Web platform.
Vanilla Dart example #
This example is a small Dart web application that loads the checked-in standalone and Emscripten WebAssembly assets and invokes generated bindings.
Files #
web/main.dart— browser entry point; it loads both module variants and adds their results to the page.lib/example_library_wrapper.dart— high-level wrapper usingDynamicLibrary.openand the web string helpers.lib/native_example_bindings.dart— bindings generated byffigen.web/assets/— standalone.wasmand Emscripten.js/.wasmassets.src/— native source used to produce the example assets.
Run #
From this directory:
dart pub get
dart run ffigen --config ffigen.yaml
webdev serve
Open the URL printed by webdev in Chrome. The application requires an HTTP
server because the browser fetches the WebAssembly assets.
The root README.md documents the package API and the
Flutter example.