Can we create shared library or assembly like .dll in flutter package project?

2,297

You can store your package on your git repository and access them.

If the package is located at the root of the repo, use the following syntax:

dependencies:
  plugin1:
    git:
      url: git://github.com/test/plugin1.git

https://flutter.dev/docs/development/packages-and-plugins/using-packages

Share:
2,297
Rakesh Kr
Author by

Rakesh Kr

Updated on December 21, 2022

Comments

  • Rakesh Kr
    Rakesh Kr over 1 year

    I'm getting problem with flutter/dart. I created one flutter-package using dart lang, there is so many dart files. But i didn't get any option to make single lib file or assembly like dll (dll in Xamarin). I want to use that API in flutter mobile app [Android/iOS]. So is it possible to make single lib file in dart ? I don't want to show a source code to that person, who will use my API in Android/iOS & I don't want to publish my code to pub.dev.

    I hope this is possible.

    Thanks, i would be grateful.

    • krishnakumarcn
      krishnakumarcn almost 4 years
      If you don't want to publish them to pub.dev, you can use your own git repository to use them on projects.
  • Rakesh Kr
    Rakesh Kr almost 4 years
    but source code still visible, is there any solution like convert into single binary file and then i can share with ?
  • krishnakumarcn
    krishnakumarcn almost 4 years
    I dont think Flutter or natively support this. As you might expect, the library code lives under the lib directory and is public to other packages. You can create any hierarchy under lib, as needed. By convention, implementation code is placed under lib/src. Code under lib/src is considered private; : From dart.dev/guides/libraries/create-library-packages
  • krishnakumarcn
    krishnakumarcn almost 4 years
    The closest thing that I could find is writing your lib in C or C++ with this docs.: flutter.dev/docs/development/platform-integration/… Can't say for sure. But if it helps you!!
  • Rakesh Kr
    Rakesh Kr almost 4 years
    I'm following library structure. Code in C++, that can be a solution. Thanks for your time @krishnakumarcn