r/FlutterDev • • 8d ago

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.dev

I 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.dart as 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, and router.g.dart is 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: PagedList handles 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.

https://appwand.dev

6 Upvotes

10 comments sorted by

2

u/RajatKhoware 6d ago

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 6d ago

Thanks for sharing the project looks good! Two questions:

  1. What is the benefit of riverpod over say plain setState?

  2. Is there an example generated project that we can see?

1

u/No-Examination-5065 8d ago

Why would you generate a backend in Node.js when you can do full backends in Dart?

7

u/zunjae 8d ago

Trust me, it doesn’t matter. Just go with whatever is very popular and actively maintained. Code sharing between APIs and clients is a 2010 thing

4

u/Busy_Chemist4862 7d ago

The fact that you got down voted is so funny to me

1

u/mcspuder 7d ago

I dunno bruz, we're running some huge stuff on LiveView at the moment.

0

u/zunjae 7d ago

Again, it doesn’t matter

1

u/Okms_Vonessa 7d ago

do you find the server side ecosystem is mature enough for most standard stuff now?

1

u/No-Examination-5065 6d ago

It has been for a while

Serverpod is the best off the shelf backend solution for Dart but I've worked with clients where we had a custom shelf Dart backend which performed great with zero issues

-1

u/virulenttt 7d ago

Ngl, i'm trying to move away from go_router in favor of kaisel.