0

i'm working on Flutter desktop application and got stuck at a point. I want to create local database for data storage. I'm using path_provider plugin to get path of directory for saving database file. the function getLibraryDirectory() not working in my application. I debug my application also at the point of creation of database this function throw exception "UnimplementedError: getLibraryPath() has not been implemented".

This is the plugin i am using. https://pub.dev/packages/path_provider

Anyone help me out there. Thanks

Dev94
  • 757
  • 6
  • 24

1 Answers1

0

I've looked into the package's sources and there is no implementation for the method getLibraryDirectory() on Windows and Linux as the property getLibraryPath() needed to call this method has not been implemented either. Based on the source getLibraryDirectory() seems implemented on MacOS only.

Here are the methods that should be implemented for Windows and Linux:

  • getTemporaryDirectory()
  • getApplicationSupportDirectory()
  • getApplicationDocumentsDirectory()
  • getDownloadsDirectory()

And one more for Windows only:

  • getPath(String folderID) // Retrieve any known folder from Windows.
Guillaume Roux
  • 6,352
  • 1
  • 13
  • 38
  • Ok got it. Thanks a lot. Could you please tell me why the build exe file of flutter desktop application not returning path of directory when run on another desktop. I am using getApplicationSupportDirectory() this method to get the path of directory for saving database file but it is not returning any path. Code is working fine on my desktop when i run the application. What can be the issue? – Dev94 Mar 05 '21 at 19:17
  • Honestly I won't be able to tell without any code sample, but this would then be another question to open if you want a complete answer. – Guillaume Roux Mar 05 '21 at 21:26