lesnitsky / flutter_localstorage

📦 LocalStorage for Flutter
MIT License
299 stars 65 forks source link

I cant find the file i created in the app folder #90

Closed jwiemann closed 6 months ago

jwiemann commented 2 years ago

I stored a file with your flutter SDK and it worked as expected. But now I'm trying to get this file from a native app. And somehow I cant find the file, even if my app has the same unique app name and a higher version number.

Where does this Package store it's files?

Thank you very much!

lenlo commented 9 months ago

The default directory for the package's files is the app's Documents directory, as returned by path_provider's getApplicationDocumentsDirectory() function. Still, it would be helpful if the package had a method that returned the full path for a store's underlying file as you may need to access it directly after using it, e.g. to rename it or to delete it when it's no longer needed.

lesnitsky commented 6 months ago

Storage file could be locatied in the application document directory. File name is storage-61f76cb0-842b-4318-a644-e245f50a0b5a.json.

Here's a simple script that will log the location of the storage file:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final dir = await getApplicationDocumentsDirectory();
  final path = p.join(
    dir.path,
    'storage-61f76cb0-842b-4318-a644-e245f50a0b5a.json',
  );

  print('Storage location: $path');
}