Skip to content

PathProvider should provide a way to access the Library directory #13474

@sroddy

Description

@sroddy

Currently under iOS PathProvider getApplicationDocumentsDirectory method returns the Documents directory.

It should be noted that this is NOT (or at least SHOULD NOT be) the standard path where an iOS app stores its data!

From https://developer.apple.com/library/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html

Use this directory (Documents directory - ed.) to store user-generated content. The contents of this directory can be made available to the user through file sharing; therefore, this directory should only contain files that you may wish to expose to the user.

Use the Library subdirectories for any files you don’t want exposed to the user. Your app should not use these directories for user data files.

Content in both directories is automatically backed up by iCloud.

BTW, It's currently very easy to access this directory (documents + '../Library') but the workaround is system-specific and not really future-proof.

As Android doesn't differentiate between the two, I think we can safely add a getApplicationLibraryDirectory that returns the AppData dir (the same as getApplicationDocumentsDirectory) under Android and the Library dir under iOS.
Maybe this is not ideal, but at least won't break BC.

I can provide a PR if the maintainer likes this approach.

Metadata

Metadata

Assignees

Labels

a: fidelityMatching the OEM platforms betterc: new featureNothing broken; request for a new capabilityp: path_providerPlugin that provides resolved paths to some platform directoriespackageflutter/packages repository. See also p: labels.platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions