-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[path_provider] add getApplicationSupportDirectory #1566
Conversation
It looks like the application support directory isn't automatically created. I'm debating whether to create it automagically, but perhaps it is best to just return the path. @mklim do you have any opinions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm debating whether to create it automagically, but perhaps it is best to just return the path.
@mklim do you have any opinions?
I think it would be nice to create it automagically on the platform side. I wouldn't want to block for two async calls through the MethodChannel and back to check if it exists and then make it if it doesn't every time though.
/// use this directory for user data files. | ||
/// | ||
/// On iOS, this uses the `NSApplicationSupportDirectory` API. | ||
/// This directory is not guaranteed to exist and you can call `createSync` to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
/// This directory is not guaranteed to exist and you can call `createSync` to | |
/// This directory is not guaranteed to exist. You can call `createSync` to |
Review feedback addressed, PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@collinjackson
This works on Android and returns a path: Yet still throws an exception: |
This should have been landed as part of the previous flutter_tools PR.
Fixes flutter/flutter#13474
This allows developers to store files that aren't user-generated in the correct folder on iOS.
Also updated the documentation:
getStorageDirectory
on Android when storing user-generated content that should be visible to the user.getTemporaryDirectory
for storing caches of files that don't need to be backed up.See https://developer.apple.com/icloud/documentation/data-storage/index.html
/cc @sroddy