dart-archive/wasm

Support Android/iOS

jlalvarez18 opened this issue · 3 comments

I am having an issue with the WasmModule loading. I have the following in my Flutter app:

  final data = await rootBundle.load('assets/add.wasm');

  final mod = WasmModule(data.buffer.asUint8List());

  print(mod.describe());

  final inst = mod.builder().build();
  final add = inst.lookupFunction('add_one');

  print(add(12));

I have run dart run wasm:setup. The issue I find is Directory.current.uri returns \ which is obviously incorrect. In particular, I am talking about _getLibPath() where locating the library fails.

Is this not designed to work with Flutter applications? Mobile in particular.

We haven't ported the package to mobile platforms yet, but we definitely plan to. I'm hoping to start working on this in a few weeks, once I finish my current project.

@liamappelbe cool. If there is any way I can contribute, let me know.

iOS forbids JIT compilation. According to wasmer, wasm files will have to be precompiled to dylibs when running on iOS devices. Therefore, I think we won't be able to just offer a single top level function for all platforms and we will need more like a configuration that takes a path to a wasm binary and a dylib once we actually support iOS.