Mani76
Mani76

Reputation: 397

Publish Flutter package to local .m2 or private Nexus-Repository

I've created a Flutter package with some code, that I use in my projects. I don't want to copy code from one project to the next one, so I'd like to have this code in a shared library.

In the pubspec.yaml there is a key word "publish_to:", but the documentation about it is very meagre.

The only thing I've found is

flutter packages pub publish

to publish the library to pub.dev - but that's not what I want.

(At the moment) I don't want to share my Flutter package with others. I'd like to have it in my local .m2 directory or my private Nexus repository. Is there a way to publish a Flutter package directly to .m2 or Nexus?

Upvotes: 2

Views: 3517

Answers (1)

A. Molland
A. Molland

Reputation: 58

Right now, your best bet is to host your code in a git repository and use git references in your pubspec.yaml as per these instructions. It doesn't look like there's any planned support for third-party package repositories like Nexus (be sure to let your needs be known to the Dart team).

If you'd like, you can also host your own server using this official pub_server package.

Upvotes: 1

Related Questions