Experimenting with Dart/WASM interop in a Dart app.
The Box2D.wasm
file comes from box2d-wasm where I:
- removed JS specific code from the C++ glue files before building (see flutter_box2d plugin for more details)
- otherwise, followed the instructions in the READMEs to build
- copied the
Box2D.wasm
file resulting from the build into this project
Run:
dart run wasm:setup
dart run bin/dart_box2d_wasm.dart
The Dart app:
- loads the wasm as a
WasmModule
- prints the available symbols
- builds an instance from the module
- looks up functions in the instance
- uses the functions to create a vector and calculate its length