Closed yashas-hm closed 5 months ago
In the documentation, it is written -
Your app should not use this directory for user data files.
Apart from some configs, we are majorly storing user data so documents folder is the right location.
My approach to solve the solution was this as support folder is always accessible. The other option is to store in app cache directory else we can prompt the use that access to the particular folder is not possible please give API Dash permission to read and write to the folder.
The document folder would not be accessible only if the user has denied permissions or added an additional firewall which would not the case for most of the users.
Apart from some configs, we are majorly storing user data so documents folder is the right location.
I think the documentation mentions the user data such as user details like name, phone etc. user sensitive details.
I guess using getLibraryDirectory
would be more logical.
Documentation Reference:
Path to the directory where application can store files that are persistent, backed up, and not visible to the user, such as sqlite.db.
Nope. Closing this PR as this is not a path issue, but permission and error handling issue.
PR Description
Added a directory path for hive to store files. The path is application support directory which will be accessible by the app irrespective of permissions by the OS firewall.
By default hive stores its files at
getApplicationDocumentsDirectory
Use
getApplicationSupportDirectory
instead ofgetApplicationDocumentsDirectory
to ensure read and write permissions. https://github.com/hivedb/hive/blob/3b12c31a221f97f5ec86fe20df63515aeedf88f0/hive_flutter/lib/src/hive_extensions.dart#L16Related issue https://github.com/isar/hive/issues/1044
Related Issues
Checklist
main
branch before making this PRflutter test
) and all tests are passingAdded/updated tests?