3

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.

Rakesh Kr
  • 41
  • 1
  • 3

1 Answers1

2

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

krishnakumarcn
  • 3,959
  • 6
  • 39
  • 69
  • 1
    but source code still visible, is there any solution like convert into single binary file and then i can share with ? – Rakesh Kr May 28 '20 at 07:21
  • 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 https://dart.dev/guides/libraries/create-library-packages – krishnakumarcn May 28 '20 at 08:08
  • The closest thing that I could find is writing your lib in C or C++ with this docs.: https://flutter.dev/docs/development/platform-integration/c-interop#closed-source-third-party-library Can't say for sure. But if it helps you!! – krishnakumarcn May 28 '20 at 08:09
  • I'm following library structure. Code in C++, that can be a solution. Thanks for your time @krishnakumarcn – Rakesh Kr May 28 '20 at 08:55