Running and Building

For Native Platforms

The following commands are just enough to run and build apps for native platforms. It’s that simple.[1]

To run the app:

CLI
flutter run

To build the app for a specific platform:

CLI
flutter build [platform]

For the Web

You need to manually build webassembly module from Rust before running or building the app for the web.[2]

To serve the web application[3]:

CLI
rinf wasm
flutter run --web-header=Cross-Origin-Opener-Policy=same-origin --web-header=Cross-Origin-Embedder-Policy=require-corp

To build the optimized release version of the web application:

CLI
rinf wasm --release
flutter build web

When deploying your web app on a web server[4], ensure that your web server is configured to include cross-origin-related HTTP headers in its responses. These headers enable web browsers using your website to gain access to SharedArrayBuffer web API, which is something similar to shared memory on the web.

Additionally, don’t forget to specify the MIME type application/wasm for .wasm files within the server configuration to ensure optimal performance.