Flutter for frontend

Has anyone gotten Flutter to work as a front end? It transpiles to JavaScript, so I imagine it’s compatible with some finagling. Just curious if it’s been done, or if I’ll be going into this blind.

7 Likes

I‘m also interested in this one @stanley.jones

1 Like

Good thread! I think I’d asked this question a while back when it wasn’t possible, but would love to know if anything has changed!

2 Likes

Update on this: I’m able to run a flutter web frontend in a canister running locally. Here’s what I did:

Build a flutter web app for release following the flutter docs.

After running flutter build web, copy everything from the output /build/web directory into your asset canister’s public folder.

Modify the dfx.json file to reference flutter’s generated main.dart.js file (ignore index.html). For example, in my flutter_on_ic project, I have:

"flutter_on_ic_assets": {
  "dependencies": [
    "flutter_on_ic"
  ],
  "frontend": {
    "entrypoint": "src/flutter_on_ic_assets/public/main.dart.js"
  },
  "source": [
    "src/flutter_on_ic_assets/assets",
    "dist/flutter_on_ic_assets/"
  ],
  "type": "assets"
}

Build and install your canisters, and launching the following URL will load your flutter frontend:

127.0.0.1:8000/?canisterId=

4 Likes