Skip to content

Conversation

@krispypen
Copy link

Description

When an android device is low on storage, it can happen that the OS clears the cache of the app. In that case we get a FileNotFoundException when running an audio file for the 2nd time.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, refactor:,
    docs:, chore:, test:, ci: etc).
  • I have read the Contributor Guide and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation and added dartdoc comments with ///, where necessary.
  • I have updated/added relevant examples in example.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

@krispypen
Copy link
Author

@Gustl22 can you have a look? 🙏

@Gustl22
Copy link
Collaborator

Gustl22 commented Jun 5, 2025

Thank you for the contribution and sorry for the delay!

if (!loadedFiles.containsKey(fileName) ||
// the file can be removed from the cache, this
// can happen automatically when the storage is almost full
(!kIsWeb && !fileSystem.file(loadedFiles[fileName]).existsSync())) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to check also check for if defaultTargetPlatform == Platform.Android, if it's something that only occurs on android.

I would also prefer to use await exists to not block the thread.

Also do you have some reference (preferably of Android) we can add to the docs here?

@spydon
Copy link
Member

spydon commented Aug 26, 2025

@krispypen are you planning on finishing up this PR? :)

@krispypen
Copy link
Author

krispypen commented Aug 26, 2025

@krispypen are you planning on finishing up this PR? :)

Oh I missed the previous message, I'll update today! @spydon

@krispypen
Copy link
Author

@spydon @Gustl22 I don't think these failing tests are something to do with this change

@spydon
Copy link
Member

spydon commented Aug 27, 2025

@spydon @Gustl22 I don't think these failing tests are something to do with this change

They don't indeed, we are looking into them. :)
Thanks for updating the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sound not found inside cache folder - app crash

3 participants