How to use my dart packages private and not show on pub dart lang?

If you publish a package to https://pub.dartlang.org it will show up. There is no way around that.

Alternatives.

You can use

  • path dependencies to packages stored on a local or network drive for example.
  • Git dependencies to packages stored in a Git repository
    • on a local or network drive
    • hosted on GitHub, GitLab, or any other Git server
  • run your own private Pub server.

See also

  • https://www.dartlang.org/tools/pub/dependencies
  • https://github.com/dart-lang/pub_server

Günter Zöchbauer answer is correct but he hasn't provided it with examples.

So to use pub/package/lib without publishing on pub.dev :

1. Local - Save in some local folder

dependencies:
  library_name:
   path: /path/to/library_name

2. Hosted - Pushed on Github, Gitlab etc.

dependencies:
  library_name:
   git: https://github.com/username/library_name

Or to target specific branch

dependencies:
  library_name:
   git:
    url: https://github.com/username/library_name.git
    ref: dev    #branch name

Or to target specific commit

dependencies:
  library_name:
   git:
    url: https://github.com/username/library_name.git
    ref: e234072340    #commit reference id

Where 'library_name' has to be the same as the 'name' declared in pubspec.yaml of that pub.


local :

To handle that, pub supports path dependencies.

dependencies:
  transmogrify:
    path: /Users/me/transmogrify

This says the root directory for transmogrify is /Users/me/transmogrify.

See : https://www.dartlang.org/tools/pub/dependencies