rpc_dart_wasm 0.2.1
rpc_dart_wasm: ^0.2.1 copied to clipboard
Runtime-agnostic WASM bridge transport for rpc_dart — turns any byte-level wasm bridge into an IRpcTransport.
0.2.1 #
The first release whose device gate ran on BOTH platforms in the same session, which is what made the parity defects visible: the two host environments do not provide the same things, and nothing that reads or compiles one half can say so.
Fixed #
- Android: a guest using
Stopwatch— or anything else on the high-resolution clock — died with an opaqueInternal server error. dart2wasm's glue callsperformance.now(); a WKWebView is a browser and supplies it,JavaScriptSandboxis a bare V8 isolate and does not. Shimmed fromDate.now(), and only when the real global is absent. - Text from the native side is decoded as UTF-8. Both plugins encode UTF-8 and the Dart side read one character per byte, so anything above ASCII arrived mangled — 17 Cyrillic characters became 30. Every test passed because they all sent ASCII, where the two readings agree exactly.
- A boot that throws synchronously is surfaced, instead of reaching the
caller later as a
LateInitializationErrorabout an unrelated field. - Glue the stripper cannot handle is named on the spot, rather than failing
later as a
SyntaxErrorthat on iOS kills the whole script tag.
Docs #
- The iOS backend is an offscreen WKWebView, not JavaScriptCore, and the README
now says why (JSC has no WebAssembly). Adds measured per-call costs for both
platforms, guest timer lag, and a note that
Stopwatchis millisecond-grained on Android.
0.2.0 #
The release where the native halves were compiled and then actually RUN. The
levels find different things and the order is strict — reading < compiling <
running: reading shipped a dead-runtime report through a call that is a no-op
after boot; compiling would not have caught the 30 s boot stall; and running is
what showed that on iOS a page loaded with baseURL: nil cannot fetch its own
module at all.
Fixed #
- A runtime that dies on its own answers its callers instead of leaving them waiting.
- iOS: the runtime could not fetch its own module, and its timers recursed. A guest whose glue code throws cost 30 s of silence before anything was reported.
- Android: a boot failure said nothing about why; a 16 MiB message killed the runtime; closing a runtime with traffic in flight killed the app.
- A running guest's failures reach the host, and a failed handler inside the guest is reported at ERROR rather than info.
close()releases both channels the bridge opened.- Bytes that arrive before the transport binds are buffered, not dropped.
- The iOS privacy manifest ships with the plugin.
Changed #
- Requires rpc_dart 6. See its changelog.
- The plugin's Swift and Kotlin are type-checked by a gate
(
melos run analyze:native), and there is a device gate that builds and runs them (melos run test:wasm:device). Neitheranalyzenortestcompiles a line of either. - The package's
dart:js_interopimplementation is compiled for a JS target bytest:wasm. It had no JS-target compile anywhere —analyzeruns over it at--fatal-infosand is structurally incapable of seeing its one failure mode.
0.1.2 #
- fix: align
RpcWasm.runstub signature with the real implementation. The VM/host stub (rpc_wasm_stub.dart) was missing theLogController? logControllernamed parameter, so code callingRpcWasm.run(logController: ...)compiled on the WASM/JS target but failed to compile on the host/VM stub target. The stub now matches the real implementation parameter-for-parameter.
0.1.1 #
- Test coverage: added transport-contract tests against an in-memory mock bridge that loops byte frames between a host and a sandbox endpoint (the same byte loop the JS/WASM bridge performs in production).
rpc_wasm_endpoint_test.dart— end-to-endRpcCallerEndpoint/RpcResponderEndpointround-trips overRpcWasmTransport: unary, server/client/bidirectional streaming, ordering, concurrent calls, mid-stream cancellation without deadlock, typedRpcStatusExceptionerror propagation, and lifecycle (use-after-dispose fails cleanly, close cascades to the bridge).rpc_wasm_transport_test.dart— expanded with stream-id uniqueness/parity,getMessagesForStreamfiltering, send-after-close, bridge-close cascade, and byte-framing (send-to-frame mapping, byte-identical round-trip).- Shared
test/support/fake_wasm_bridge.dartmock bridge. - Note: the real JS/WASM sandbox round-trip (
RpcWasm.run,RpcFlutterWasmBridge) still requires a browser/device with a loaded WASM module and a native host; everything above the byte boundary is now covered without one.
0.1.0 #
- Initial release: WASM transport for rpc_dart as a Flutter plugin.
RpcWasmTransport—IRpcChannelimplementation bridging Dart↔WASM viaRpcWasmBridge.RpcFlutterWasmBridge— Flutter plugin bridge using platform channels (Android: Kotlin, iOS: Swift) to load and run WASM modules in a sandboxed JS environment.RpcWasmBridge— pure Dart WASM bridge for non-Flutter targets.- WASM sandbox executes widlet/plugin code in isolation; messages pass as binary frames over the bridge.
- Android:
RpcDartWasmPlugin(Kotlin) with QuickJS-based WASM execution. - iOS:
RpcDartWasmPlugin(Swift) with JavaScriptCore-based WASM execution.