Skip to content

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] # Replace it with a platform name

🌍 For the Web

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

To serve3 the web application4:

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 application5:

CLI
rinf wasm --release
flutter build web

When deploying your web app on a web server, 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.


  1. Rinf builds the native Rust library and links it to the Flutter app using Cargokit

  2. Internally, Rinf uses wasm-bindgen and wasm-pack with the web target

  3. Note that Flutter apps in debug mode are known to be quite slow on the web. It is recommended to use profile mode when testing on a web browser. 

  4. Since repeatedly writing web header arguments during development can be overwhelming, Rinf provides a convenient command rinf server that prints the full Flutter web command. 

  5. Rinf supports hosting a Flutter app at a non-root location. For example, you can place your Flutter app in https://mywebsite.com/subpath/deeperpath/