I'm writing a dart package in which I require the path to a file within the package to access the file for the package to work. The package is not written for the web platform. My understanding of where packages are stored is limited, however, I would assume that there won't be a common directory for each platform, and even within platforms, I suppose it would vary based on how dart was installed on the specific machine.
Despite this being rather obvious that Dart as an AOT language would mean that the file being executed is just one snapshot. I would want to know if there is a way I can access the directory structure of package without having the end-user having to pass path values to me.
To give you some context, I want to load a dynamic library on runtime using dart:ffi, and do so within a package which will be published to pub.dev with the libraries. Do let me know if you have any ideas.
What I've tried so far:
Directory.current.path: This is obviously not going to work.${File(Platform.resolvedExecutable).parent.path: This seems to be a workaround for Windows machines, I don't know how this would be useful for Linux, MacOS, or even Android and iOS for that matter.Directory.fromUri(Platform.script): This leads me to the snapshot created by the compiler on Linux, nevertheless, of no use to me.