> For the complete documentation index, see [llms.txt](https://docs.onepub.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.onepub.dev/guides/publishing-packages.md).

# Publishing Packages

## Permissions

Only Uploaders may publish a package. Each edition of OnePub defines an Uploader differently.

{% tabs %}
{% tab title="Free/Pro" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

All packages are associated with the Default Team and as such all Members have access to the package.
{% endtab %}

{% tab title="Team" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

To share a package it must be associated with a Team which only Team Leaders and/or Administrators may do.
{% endtab %}

{% tab title="Enterprise" %}
As all Members are Uploaders any Member can create a new package by running 'dart | flutter pub publish'.

To share a package it must be associated with a Team which only Team Leaders and/or Administrators may do.
{% endtab %}
{% endtabs %}

{% hint style="success" %}
The secret to successfully publishing a package is.... good documentation.

Add a readme.md, take some time to document your public API and throw in some examples.
{% endhint %}

## Security

The largest risk you face is accidentally publishing your package to pub.dev.

## Publishing

If this is your first time publishing a package then you might find our blog article on publishing useful:

* [Publish your first package](https://onepub.dev/Blog?id=zuhnoflygz)

### Mark package as private

To prepare a package for uploading to OnePub you must mark it as a private package.&#x20;

Run the `onepub pub private` command:

```bash
onepub login # if you are not already authed
onepub pub private 
```

This has the effect of adding a `publish_to` key to your `pubspec.yaml` file. The `publish_to` instructs dart to publish you package to OnePub rather than pub.dev.

And now publish your package to OnePub:

```
dart pub publish
```

{% hint style="warning" %}
Note: you can add the publish\_to key manually by following [the hard way](/guides/publishing-packages/the-hard-way.md) instructions.
{% endhint %}

### Public Packages

Some of your team members may need to publish both private and public packages.

All **public** packages should be published directly to pub.dev using the standard dart tooling/processes.

**Public packages** you upload to pub.dev will be cached on onepub.dev within a few minutes of you publishing to pub.dev, so you can easily find these packages on OnePub as well as pub.dev

## Teams

If your OnePub organisation has multiple teams (you need the Team or Enterprise license) then are some additional steps required when uploading a package.

The core issue is that you need to nominate the team the package belongs to before uploading the package.

A package may be associated with multiple teams.

To associate a package with a Team

* Navigate to My OnePub | [Managed Packages](https://onepub.dev/DartPackageList)
* Create a new package
* Enter the package name and description.
* On the Teams tab, select each of the teams the package is associated with.
* Save the new package.

You can now publish your package from the CLI as per the normal process.
