2

I've a package which ships with some lib's(*.so and *.dll), when i try accessing them from my a project, it always returns no such file or directory.

I think whenever a plugin is being used, the working directory is pointing at the directory of project. One way to fix this is to ask the user to download the lib's into there directory. But that defeats the purpose of a package.

Is there anyway to make dart find the lib in the package directory instead of the current project.

Frank nike
  • 330
  • 5
  • 12
  • 1
    See the discussion from the discontinued [resource](https://pub.dev/packages/resource) package. AOT compilation etc means that your package files won't be available at runtime, so you are really left with the user downloading/installing them at some known location and having your package look for them there. See the [libsodium](https://pub.dev/packages/libsodium) package as an example of the known location approach. Or the competing [sodium](https://pub.dev/packages/sodium) package for a Flutter-friendly approach. – Richard Heap Mar 06 '22 at 21:24
  • I was about writing an answer with exactly what you suggested. I initial had this problem with flutter but i was about to solve it by making flutter compile the cpp source code in the package. I think I'll automatically download the lib to a specific location. Thanks for your help. – Frank nike Mar 06 '22 at 23:20
  • 1
    FWIW, I've always found it easiest (for a Flutter plugin) to include the source, if available. – Richard Heap Mar 07 '22 at 00:53

0 Answers0