Tested with Dart SDK v3.5.2,
packages:fetch_client
v1.1.2,
Chrome browser v124.0, Firefox browser v122.0, Deno 1.46.3, and Node.js 22.8.0 .
- Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.
cd
into the folder of this example:
cd browser-and-node-package-fetch-client
- Ensure all dependencies are installed:
dart pub get
cd
into theweb
subfolder, where sources are located:
cd web
- Compile the example:
dart compile wasm main.dart
- Run simple HTTP server to temporarily publish project to Web:
python3 -m http.server
Codespace will show you "Open in Browser" button. Just click that button or obtain web address from "Forwarded Ports" tab.
- As
index.html
and a 315k-sized wasm file are loaded into browser, refer to browser developer console to see the results.
- Run with Node.js:
node node-and-deno.mjs
- Install Deno:
curl -fsSL https://deno.land/x/install/install.sh | sh
- Run with Deno:
~/.deno/bin/deno run --allow-read --allow-net node-and-deno.mjs
Perform your own experiments if desired.