Testing & debugging
Apps break, that is normal. FlutterGo is built so that most breakage fixes itself: after each change the agent runs flutter analyze and repairs what it finds, and compile or runtime errors in the preview come with one-click fix buttons.
Here we show you the testing loop: run the app, read what went wrong, let the agent fix it, and use the two classic first-aid buttons, Pub get and Clean, when a build behaves strangely. You'll also learn when to use Hot reload versus Hot restart.
You don't need to install anything. Everything below happens in the browser preview; simulators and devices are optional extras.
What you need#
- Your project has generated code (the preview says "Ask the agent to scaffold pubspec.yaml and lib/main.dart, then click Build." if not).
- You know where the preview rail and project toolbar are (workspace callouts ④ and ⑤).
How to do it#
1. Run the app#
Use the preview rail on the right. Click Run app, the app compiles ("Building Flutter web preview…") and starts in the phone frame. Stop ends the session; Rebuild does a full rebuild.
The preview rail: Run app, Hot reload, Hot restart, Stop, Analyze, and more.
You can also pick where to run with Run on: Web preview, iOS Simulator, or Android Emulator (simulators need the desktop app and show hints like "Use the Simulator or Emulator window on your Mac. Hot reload and restart buttons apply there.").
2. Check project health with Analyze#
Click Analyze in the preview rail. It runs flutter analyze, the Analysis panel shows "Running flutter analyze…", then either "No issues found" or counts like "{count} errors" and "{count} warnings" under Project issues.
Tip: You rarely need to fix these yourself. Click Send to AI on the issue list and the agent repairs them.
3. Understand the automatic repair loop#
Auto-repair is on by default. After every agent change, flutter analyze runs and the agent fixes its own findings, compile errors, broken layouts, web-preview issues, and bad network images. When the preview itself hits trouble, you get buttons instead of stack traces:
- Compile errors panel with a Fix compile errors button.
- Fix runtime errors for errors caught while the app runs.
- Auto fix on preview action cards in chat.
- If errors block running, the rail says "{count} compile errors, fix or send to AI before run".
4. Read the debug panel#
When you need detail, open the debug logs. The panel is titled Preview debug logs: "Build output from the Flutter preview server, plus runtime errors from the in-app browser console. Gray or blank UI? Expand Runtime errors below or click Open in browser (F12)."
It contains:
- Phase and Preview URL, where the preview is in its lifecycle.
- Build logs, compiler output.
- Runtime errors (browser console), what the running app printed.
- Copy logs, copy everything to paste into chat.
- Open in browser, open the app in a full tab for browser DevTools.
5. Ask the agent to fix it (paste the error)#
The fastest debugging tool is the conversation. Click Copy logs (or copy just the red error text), paste it into the composer, and add one line: "fix this". The error message is all the agent needs, it locates the file, repairs it, and offers a reload button in its reply.
6. First aid, Pub get and Clean#
Two buttons in the project toolbar solve a surprising number of "weird" problems:
The project toolbar. Pub get and Clean are your first-aid kit.
- Pub get, re-resolves packages. Use it after dependency changes, or when imports mysteriously fail.
- Clean, clears build artifacts. Use it when a build behaves strangely for no visible reason, then run again.
The order that works: Stop, then Clean, then Pub get, then Run app.
7. Hot reload vs Hot restart#
After the app is running, two buttons apply changes:
| Button | What it does | Use it when |
|---|---|---|
| Hot reload | Applies UI changes in about a second and keeps app state (your navigation position, typed text, toggles). | After most edits, the fastest loop. |
| Hot restart | Restarts the app with fresh state. | State-related bugs: init logic changed, providers/singletons updated, or the app is stuck in a bad state that reload keeps reproducing. |
Rule of thumb: if a change "didn't take" after Hot reload, or the bug only makes sense with stale state, click Hot restart. If even restart looks wrong, Rebuild.
Success: Most fix-verify loops are: agent fixes, then Hot reload, then confirm in the preview. Seconds, not minutes.
8. Test like a user#
Before calling a screen done:
- Click through every button and back gesture in the preview frame.
- Try empty and long input in every text field.
- Use Open in browser to test full-window behavior and browser DevTools.
- Optionally Build APK to install the Android build on a real device.
Troubleshooting#
Problem: The preview won't start or looks stuck. Possible causes: A stale session, or a heavy first compile. Solution:
- Click Stop, then Run app again.
- Still stuck? Clean (toolbar), then Pub get, then run again.
- If the agent just made a big change, give the first compile a moment, the initial build is the slow one; hot reloads after it are fast.
Problem: The build succeeds but the screen is gray or blank. Possible causes: The browser is still loading, or a runtime error inside the iframe. The panel itself hints: "Blank preview after a successful build usually means the browser is still loading or a runtime error in the iframe." Solution:
- Open Preview debug logs and expand Runtime errors (browser console).
- Or click Open in browser and check DevTools, then Console (F12).
- Paste what you find into chat, or click Rebuild.
Problem: "Running flutter analyze…" shows issues after generation. Possible causes: That's normal during generation, the agent repairs its own analyze findings automatically. Solution:
- Wait for the run to finish; most issues disappear on their own.
- If issues persist, click Send to AI or ask: "fix the analyzer errors".
Problem: Run is blocked with "{count} compile errors, fix or send to AI before run". Possible causes: Manual code edits or an interrupted agent run left the project uncompilable. Solution:
- Click Fix compile errors (or Send to AI in the Analysis panel).
- When the agent finishes, click Run app again.
Problem: "Build failed" appears in the preview. Possible causes: Dependency or compile problem. Solution:
- Open Preview debug logs, then Build logs and read the last lines.
- Click Copy logs, paste into chat, ask the agent to fix.
- If it mentions packages, click Pub get and retry; as a last resort Clean then run.
Problem: My change doesn't show up after Hot reload. Possible causes: The change touched startup/init code that reload cannot apply. Solution:
- Click Hot restart.
- If it still doesn't show, click Rebuild.
FAQ#
Do I have to run Analyze myself? No. The agent runs flutter analyze after its own changes and fixes the findings. The Analyze button is for checking health on demand.
What's the difference between Hot reload, Hot restart, and Rebuild? Hot reload applies UI changes and keeps state. Hot restart restarts the app with fresh state. Rebuild recompiles everything from scratch.
Where do I see print/log output from my app? Open Preview debug logs, runtime output is under Runtime errors (browser console); compiler output is under Build logs. There is also a View logs action in the rail.
When should I use Clean? When a build behaves strangely for no visible reason, Clean clears build artifacts. Follow it with Pub get and a fresh Run app.
Can I debug on a real device or simulator? Yes, pick iOS Simulator or Android Emulator under Run on (desktop app required), or Build APK to side-load an Android build. Hot reload works on the device too.
What should I paste into chat when asking for a fix? The exact error text, use Copy logs for everything, or copy just the red error. Include which screen you were on if the error is a runtime one.
Where to go next#
- Preview, run & build, every preview rail and toolbar button in detail.
- Working with the AI agent, writing the fix prompt.
- Troubleshooting & FAQ, product-wide fixes beyond code errors.