r/FlutterDev • u/emman-ok • Oct 31 '26
Tooling What the Flutter code looks like when an AI app builder has to follow a fixed contract (Riverpod 2.6 + go_router 14 + dio)
https://appwand.devI build AppWand, a desktop tool that generates Flutter apps with an Express API. I wanted to share how the generated Flutter side is organised, because "AI-generated Flutter" usually means one 2,000-line file, and I tried hard to avoid that.
- One folder per page:
lib/features/<page>/, with<page>_page.dartas the entry. The AI may only write inside that folder (the server rejects any other path). - Shared code is never written by the AI:
lib/core/(API client, auth, theme, list widgets, form fields, charts) comes from templates, androuter.g.dartis regenerated from the page plan. - Riverpod 2.6 for state, go_router 14 with a
ShellRoute, so the side menu or bottom tabs stay still and only the page animates. - Theming without touching pages: 16 UI styles, icon sets and fonts are all in
core/theme.dart/core/icons.dart. Switching style rewrites one file and hot reload shows it. - Shared list widget:
PagedListhandles paging, pull to refresh, skeletons, empty/error states, and switches to a data table above 840px wide.
The output is plain code you own. Happy to answer questions about the architecture, or hear where you'd do it differently.
6
Upvotes
2
u/RajatKhoware Nov 01 '26
A fixed contract is what keeps AI-generated Flutter maintainable, otherwise every generation drifts into a new pattern. The real question is what happens when the model wants to break the contract, does it ask, or does it silently drift?
1
u/whackylabs 29d ago
Thanks for sharing the project looks good! Two questions:
setState?1
u/No-Examination-5065 Oct 31 '26
Why would you generate a backend in Node.js when you can do full backends in Dart?
-1
u/virulenttt Oct 31 '26
Ngl, i'm trying to move away from go_router in favor of kaisel.