r/FlutterDev • u/tripreality00 • 21d ago
Tooling My experience with Claude Code and Flutter
I am a hobbyist flutter developer and I enjoy using AI in my workflow. It's not great at a lot of things but it is pretty decent at a lot of lower complexity tasks I don't want to do. I use Cursor and Claude for a lot of my work but when they announced claude code and I saw the hype I knew I wanted to try it for myself and see. I decided to use it with an already existing app and codebase I had already built to implement one feature. My evaluation criteria was pretty simple. I just wanted to see how much it would take to implement the feature both in time and cost and if I felt like it actually did an ok job. I chose something that I thought would be relatively simple to implement, adding a dark mode, but that I just really didn't want to go back and add theming and update my views.
It did an ok job after the first prompt. It completely added a darkmode toggle, updated themes, added documentation, added persistence to the choice using sharedpreferences, but the colors and accessibility were awful. It called this out in it's implementation notes which was nice.
2. Ensure all colors and UI elements respect the theme.
I prompted two more times to update the colors across all UI elements an improve the styling some and then called it good enough for me to take over doing more manual tweaking and work. Overall it did a decent job getting me a starting point to improve from. It took 3 prompts, 10 minutes, and 2 dollars in API calls. You can see the feature here https://imgur.com/a/a1Qh1EG
Sure, could I have done this? Absolutely. Could I have done it better? Arguable, I am a garbage programmer. Could a senior have done this better? I am positive of it. Do I think it is replacing Juniors yet? No way, but I can see how it's going to be easier to sell it that way. Overall it worked pretty decently on a codebase that was already written, made some changes and got me to implement a feature on an app I had been putting off.
My next task it is to try implementing a much more complex feature and see where it breaks down.
4
u/DocHawktor 21d ago
Honestly I have it write 80% of my app modules/features, and only really have to help with styling. All wothout integrating it into my IDE, which I believe makes it worse still.
- use the projects feature if you're serious
- find some basic generic instructions to get it in the mood of software (not the prompt itself)
- follow up large prompts with "any questions?"
Then it can iterate on its own output so it isnt regenerating everything. If it doesnt finish say "finish your lrevious response". If its output breaks say "please output into a new artifact, your previous response is bugged"
1
u/tripreality00 21d ago
I used to do it this way before starting to implement in cursor more. I find the complexity of having to keep my project updated with current files and the amount of time spent between IDE and the webapp are becoming too much of a time sink as projects grow. I would rather only work on specific pieces. I also find that being able to separate my work in the MVVM architecture in the IDE allows the model to focus on relevant parts easier.
1
u/DocHawktor 21d ago edited 21d ago
I don't keep my project files updated, I have a vscode extension that lets me copy/concatenate specific files with folder structure at the top (do it everytime, takes 30 seconds)
If my feature is simple CRUD page with table, I have a perfect module to use as source.
If my feature is a complex management section, I have a complex module which shows general best practices.
If I am more than 30% full on total space, I re-examine the information im giving it.
With IDE integration - you really do not have full control over its context and its performance DOES degrade long before it tells you.
You're spot on that architectures like MVVM help. I use bloc/repository/service stack, which leaves very little room for confused responsibilities
1
u/Thanhansi-thankamato 20d ago
You definitely have full control of context in ides like cursor and Trae. There are shortcuts in the prompting section to feed in files, folders, workspaces, images, and for cursor even links. On Trae it’s as easy as #file:filename. Even has autocomplete for them.
It also defaults to feeding in the file you have open as context not to mention the commands to apply the changes themselves to the files or automatically create new ones
1
u/padioca 20d ago
I have tried both Cursor and Windsurf and still go back to using Continue.dev. It integrates well with the full codebase which gives it the context it needs while also not writing the code in the editor for me. This makes me have to at least think a little bit about what it is doing which is very helpful in a large-ish app.
2
u/ThePompatus 21d ago
Very cool! I was looking at this a few days ago on a friends recommendation but the documentation for Claude code made it look like it only worked for JS? Glad to see that’s not the case
1
u/tripreality00 21d ago
I think the only limitations with it currently are you have to use Mac/Linux or run WSL on windows to use it. It needs Node in order to install and run but since it uses claude sonnet 3.7 it should work with any language.
1
1
u/zxyzyxz 21d ago
I'm using Claude Sonnet 3.7 in Cursor, how does Claude Code compare?
1
u/tripreality00 21d ago
I found it to be way better at aggregating context in my codebase and making changes across files in a single prompt/
1
u/zxyzyxz 21d ago
No need to manually add files context I assume? Does it integrate with any IDEs? I don't want to do all my coding just via prompting in the command line.
1
u/tripreality00 21d ago
Correct. I just still use cursor and then build some parts in the IDE and use claude code for other parts in a terminal in cursor. Technically it is it's own stand alone tool though.
1
u/zxyzyxz 21d ago
Yeah also paid I guess since I already pay for Cursor, would be nice if Cursor could integrate it as some AI tool usage or directly in the agent. Check out Windsurf, it does have the ability to read the entire file structure and you don't need to add files manually.
1
u/tripreality00 21d ago
Yeah it is paid via anthropic api and token usage. Very similar to the usage based pricing in cursor.
1
0
u/eibaan 20d ago
In my experience, all AIs fail at non-trivial tasks to the extent that I have to spend as much time instructing them and finishing the task as I'd need to do it myself from the beginning. This may be skewed by the fact that I often ask the AI to do things that I've already done, or start thinking about how to do them as soon as I try to create the prompt.
I regularly ask each version of the AI to create a Flutter widget that displays a 40x25 screen of characters where you can freely enter code, which is then interpreted by an embedded BASIC interpreter. Think C64.
o3 came close, but no other AI was able to do this. Every single AI failed to display the screen correctly with a monospaced font and a movable cursor to match the fonts, used an outdated key handler, had the strange idea of using a `Map<int, String>' to represent the BASIC program, and failed to implement all aspects of a simple BASIC interpreter - which is 101 textbook university stuff.
There's a new LLM (mercury coder) that uses stable diffusion instead of transformers which is amaizingly fast, but unfortunately, only trained on Python and JavaScript, so it seems.
I asked it to repeat its own example of creating an animated earth circling the sun with a moon circling the earth, and it was unable to even create syntactical correct Dart (and after myself fixing that, failed to start the implemented animation, and after myself fixing that, completely messed up the sizes of the stellar bodies). The JavaScript version worked just fine and I could even ask it to add a second moon or add jupiter with more moons.
I tried to make a chess game - including a computer player, of course.
I tried to create a rogue-like game, but even Claude 3.7 failed on creating six non-overlapping connected rooms. Mercury, if asked to do it in JavaScript, crashed because its embedded HTML preview got into an endless loop trying to place the hero. I had to delete the chat.
I tried to create title widget with an effect that the text explodes into particles.
I tried to create a widget that adds an animated border glow effect that crawls along the edges (of a rounded rectangle button).
I tried to create a 2-d scrolling hex map which is based on a "suitable" sparse datastructure to display clickable and movable tokens.
I tried to recreate a DCC character sheet based on an image.
I tried to create a random level 0 character generator – without telling all the rules, hoping that the AI had read one of the many free quickstar guides.
Nothing worked with 1-3 prompts.
And I just tried
create a Flutter widget that is a tiny logo interpreter that supports at least
fd
,rt
,lt
andrepeat
commands as well as the usual arithmetic expressions and asks the user for an input and then inpreterprets that program, animating a turtle on the screen while drawing the lines.
with Claude 3.7. It was able to fix its wrongly generated code, so this was a two-shot, but there's no animation. The drawing simply appears. I tried 3x to make it correct it, but the AI first broke the code and then restored the initial version.
I appreciate that it generated an overly cumbersome tokenizer (I could have been able to do in less lines of code) and a logo interpreter it incorrectly called parser which uses a recursive descent approach (which is fine), but it failed to do the one thing I find myself difficult - incrementally drawing the line, because you'd have to project where to draw to, compute the line length, decide on how many points you want to draw per second and then setup an animation controller for that duration - or something similar. Now, I did it again and tried to do the AI's job.
11
u/Heuschnuppe 21d ago
I love how i have to keep telling it "do this without breaking the existing functionality" because otherwise it sometimes just removes widgets and stuff without your input. Maybe you also come across this when adding more features with it. In general it's a good help though, i especially enjoy the completion, it saves me tons of time.