getApplicationDocumentsDirectory data loss

Viewed 119

Hello Fellow Flutter/Dart developers,

I have an app that writes and reads from the local file system (iOS). I use the following to read the files:

final d = await getApplicationDocumentsDirectory();
d
 .list(recursive: false, followLinks: false)
 .listen((FileSystemEntity entity) {
 if (entity.path.endsWith(".json")) {
    /* read file */
 }

This worked beautifully until the last app update. Now the listing doesn't show the previously saved files, it is empty.

In what circumstances can the files saved in /var/mobile/Containers/Data/Application/{app-guid}/Documents can be lost?

From other answers related to this, iOS copies over the files to a new {app-guid} folder when I update the app.

  • I haven't changed the BundleID (that's not even possible for an update)
  • I've changed the minimum iOS version to 10.0 (To get firebase dependency to build)
  • Signing method may have changed, does that matter?
0 Answers
Related