cd /news/developer-tools/dart-and-flutter-tests-filling-the-d… · home › topics › developer-tools › article
[ARTICLE · art-179201] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Dart and Flutter tests filling the disk: diagnose and choose a fix (agent prompt)

A developer published an agent prompt that diagnoses disk-filling by `dart test` and `flutter test`, which compile each test file to 20–30 MiB kernel (.dill) files in the system temp folder. The writeup identifies two causes: package:test 1.32 and earlier retain every kernel file until a run ends (fixed in test 1.33.0), and both runners leave `dart_test.*` and `flutter_tools.*` folders behind after SIGHUP or SIGKILL. It offers six remediation options, from cleaning leftovers and upgrading package:test to relocating TMPDIR or scheduling cleanup, and changes nothing until the user chooses.

recommendation

Upgrade package:test to 1.33.0 where the Flutter pin allows it, and add a dry-run scheduled job that deletes only stale, unused dart_test.* and flutter_tools.* temp folders.

more in playbook: Running AI in production
by read3 min views2 publishedNov 30, 2026

Give this file to your coding agent. It explains the problem, checks your machine, and asks you how you want to handle it. It changes nothing until you choose.

dart test and flutter test compile each test file to a kernel (.dill) file in the system temp folder. Two things make that folder grow:

  1. Growth during a run (dart test). In package:test 1.32 and earlier (test_core 0.6.20 and earlier), the runner keeps every kernel file until the whole run ends. Each one can be 20–30 MiB. A package with 200 test files can hold 7 GiB or more while it runs. Several agents or worktrees running tests at once multiply this. Fixed intest 1.33.0 (test_core 0.6.21). Seedart-lang/test#2710 .
  2. Leftovers after a killed run (dart test and flutter test). Both delete their temp folder when a run finishes, and on Ctrl-C or SIGTERM. Neither cleans up after SIGHUP (the terminal or agent session closed) or SIGKILL (force kill, for example after a timeout). Later runs do not remove these folders. Seedart-lang/test#2711 andflutter/flutter#84094 .
How the run stopped dart test flutter test
Finished, Ctrl-C or SIGTERM Cleaned up Cleaned up
Session closed (SIGHUP) dart_test.* left flutter_tools.* left
Force kill (SIGKILL) dart_test.* left flutter_tools.* left

Why you may not have the fix yet. In a pub workspace that includes a Flutter package, flutter_test pins test_api to an exact version, which caps package:test:

Flutter Newest test Has fix 1?
3.50 and earlier 1.32.x or older No
3.51 and later 1.33.0+ Yes

Pure Dart packages outside a Flutter workspace can use test: ^1.33.0 now. Never override test_api to get the fix early.

Do not create, edit or delete anything in this step. Report:

  • OS and where the system temp folder is (macOS: getconf DARWIN_USER_TEMP_DIR ; Linux:$TMPDIR or/tmp ; Windows:%TEMP% ), and how much free space that drive has.
  • Any dart_test.* andflutter_tools.* folders there: count, total size, newest change time, and whether a running process still uses them.
  • For the current project, the resolved test_core version (pubspec.lock ) and Flutter version, and whether it has fix 1.
  • Which shells and agents the person uses, and whether any agent runs in a sandbox that limits where it can write.
  • Other drives with more free space, if any.

Show the diagnosis, then offer only the options that fit this machine. Say what each changes and what it does not cover. Wait for the person to choose. They may choose several or none.

  • A. Clean up now. Remove leftover folders that nothing is using and that have not changed recently. Show the list and get a yes first.
  • B. Upgrade package:test. Only if the Flutter pin allows test 1.33.0 or later. Fixes growth during a run, not leftovers.
  • C. Move the temp folder to a larger drive. SetTMPDIR in a file every shell reads. Keep a fallback for when the drive is not mounted, becauseflutter fails ifTMPDIR points to a missing folder. Does not cover programs an app starts without a shell. Sandboxed agents may need the new folder added to their allowed write paths; find their real setting, do not guess.
  • D. Scheduled cleanup. A job (launchd, cron, systemd timer or Task Scheduler) that removes onlydart_test.* andflutter_tools.* folders that are stale and not in use. Default to a dry run. Show the script and schedule before installing.
  • E. Limit parallel runs. Run fewer test suites at once across agents or worktrees, for example with--concurrency or one test run per machine.
  • F. Do nothing. Report only.

Do only what the person chose. Back up any file before you edit it. After each change, run one short test and show that the temp files land where expected and are gone when the run finishes. Do not touch the analyzer cache, pub cache, build folders or source files unless the person asks.

── more in #developer-tools 4 stories · sorted by recency
── more on @dart 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/dart-and-flutter-tes…] indexed:0 read:3min 2026-11-30 · —