Flutter app "documents and data" disk usage is too high on iOS


I have written a very simple app in Flutter, for both iOS, Android and the web.

Lately, I realized that if I browse the "storage" settings page on my iPhone, my prod app, as it is distributed on the App Store, weighs about 500 MB. Most of it comes from the "documents and data" part, the app itself isn’t huge:

Storage page
enter image description here

This is unexpected as the only thing I am storing on purpose is a small sqlite database, which in my case is about 30 KB.

Following this guide from the Apple support page, I was able to download my app’s container, which is indeed about 500 MB. It turns out most of the weight comes from inside of a tmp folder, as shown by the output of du -sh AppData/tmp/*:

  0B    AppData/tmp/count0fSKCX
  0B    AppData/tmp/count1N2yFY
 32K    AppData/tmp/count1tKqnr
  0B    AppData/tmp/count2BxlSk
 24K    AppData/tmp/count2VKOVX
  0B    AppData/tmp/count2tnzwn
  0B    AppData/tmp/count8kl1hK
 53M    AppData/tmp/count8kqOke
  0B    AppData/tmp/count8ssdC7
  0B    AppData/tmp/countZHwkA9
 26M    AppData/tmp/countZHx1v8
 53M    AppData/tmp/countZKP9JU
  0B    AppData/tmp/counta5fYmx

If I take a look at what’s inside of one of those huge 50+ MB folders, here is what takes so much space:

du -sh AppData/tmp/countZKP9JU/count/*

 26M    AppData/tmp/countZKP9JU/count/main.dart.dill
 20K    AppData/tmp/countZKP9JU/count/main.dart.incremental.dill
 26M    AppData/tmp/countZKP9JU/count/main.dart.swap.dill

I failed to find useful documentation about those files, as I am not sure what to look for: is the problem in my Dart config, in my Flutter config, in my App config, …? Can you guys please enlighten me?

Edit: Here is some version info that might be useful

  • Flutter 2.5.1 • channel stable • https://github.com/flutter/flutter.git
  • Framework • revision ffb2ecea52 (5 weeks ago) • 2021-09-17 15:26:33 -0400
  • Engine • revision b3af521a05
  • Tools • Dart 2.14.2
  • iOS version: 15.0.2


In case someone runs into the same issue, I ended up writing my own cleanup logic on startup, calling getApplicationDocumentsDirectory().parent.list() and then deleting the tmp child folder if it exists.

I don’t know if this is necessary at all in the end, as this tmp folder growing infinitely might only happen because of the development builds I keep installing on my phone. But this cleanup step probably won’t hurt anyway.

Answered By – Mathieu

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.