Skip to main content

Publish scoped public package

To share your code publicly in a user or organization scope, you can publish public user-scoped or organization-scoped packages/plugins to the dartpm registry.

Note

Before you can publish user-scoped dartpm packages, you must sign up for the dartpm account. Additionally, to publish organization-scoped package, you must create the dartpm user account, then create an npm organization.

Creating and publishing scoped public packages

Note

This article preassumes that you already have dartpm command line tool installed and login. To install and setup, visit "dartpm cli installation"

  1. On the command line, create a flutter package.

    flutter create --template=package hello
  2. Navigate to the root directory of your package:

    cd hello    
  3. Update pubspec.yaml

    publish_to: "https://dartpm.com/registry/<scope-name>"
    • scope-name is username for user scope and org-name for organization scope.
  4. Run the publish command

    dart pub publish
  5. If organization don't allow private packages then the published package will be public, otherwise all the published package are private and there status can be changed from package settings in web.

TIP

When user is added to the new organization, the user needs to run dartpm login again to set the new organization. If you face any issue in publishing package, it is recommended to do dartpm login again.