

Dart is a client-optimized programming language developed by Google.
For more information on Dart, please see:
In the following examples:
Identifier | Description |
---|---|
OWNER | Your Cloudsmith account name or organisation name (namespace) |
REPOSITORY | Your Cloudsmith Repository name (also called "slug") |
TOKEN | Your Cloudsmith Entitlement Token (see Entitlements for more details) |
USERNAME | Your Cloudsmith username |
PASSWORD | Your Cloudsmith password |
API-KEY | Your Cloudsmith API Key |
PACKAGE_NAME | The name of your package |
PACKAGE_VERSION | The version number of your package |
DEPENDENCY_NAME | A name for a dependency in a pubspec file |
Upload a Package
Upload via the Cloudsmith CLI
For full details of how to install and setup the Cloudsmith CLI, see Command Line Interface.
The command to upload a Dart package via the Cloudsmith CLI is:
cloudsmith push dart OWNER/REPOSITORY PACKAGE_NAME-PACKAGE_VERSION.tgz
Example:
cloudsmith push dart org/repo your-package-1.0.0.tgz
Upload via Cloudsmith Website
Please see Upload a Package for details of how to upload via the Website UI.
Download / Install a Package
Setup
Cloudsmith Dart repositories don't (currently) proxy upstream sources, and so can only serve packages which have been explicitly pushed.
Before you can install packages from your Cloudsmith repository you'll need to configure your environment for access. The configuration is defined using the PUB_HOSTED_URL
environment variable.
Public Repositories
Linux / Mac
export PUB_HOSTED_URL=https://dl.cloudsmith.io/public/OWNER/REPOSITORY/dart/
Windows (cmd)
set PUB_HOSTED_URL=https://dl.cloudsmith.io/public/OWNER/REPOSITORY/dart/
Windows (Powershell)
$env:PUB_HOSTED_URL=https://dl.cloudsmith.io/public/OWNER/REPOSITORY/dart/
Private Repositories
Private Cloudsmith repositories require authentication. You can choose between two types of authentication, Entitlement Token Authentication or HTTP Basic Authentication.
The setup method will differ depending on what authentication type you choose to use.
Linux / Mac
export PUB_HOSTED_URL=https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/dart/
export PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
export PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
export PUB_HOSTED_URL=https://token:[email protected]/basic/OWNER/REPOSITORY/dart/
Windows (cmd)
set PUB_HOSTED_URL=https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/dart/
set PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
set PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
set PUB_HOSTED_URL=https://token:[email protected]/basic/OWNER/REPOSITORY/dart/
Windows (Powershell)
$env:PUB_HOSTED_URL=https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/dart/
$env:PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
$env:PUB_HOSTED_URL=https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
$env:PUB_HOSTED_URL=https://token:[email protected]/basic/OWNER/REPOSITORY/dart/
Specifying Dependencies
Add the following to the dependencies section of your pubspec.yaml
file:
Public Repositories
dependencies:
DEPENDENCY_NAME:
hosted:
name: PACKAGE_NAME
url: https://dl.cloudsmith.io/public/OWNER/REPOSITORY/dart/
version: PACKAGE_VERSION
Private Repositories
dependencies:
DEPENDENCY_NAME:
hosted:
name: PACKAGE_NAME
url: https://dl.cloudsmith.io/TOKEN/OWNER/REPOSITORY/dart/
version: PACKAGE_VERSION
dependencies:
DEPENDENCY_NAME:
hosted:
name: PACKAGE_NAME
url: https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
version: PACKAGE_VERSION
dependencies:
DEPENDENCY_NAME:
hosted:
name: PACKAGE_NAME
url: https://USERNAME:[email protected]/basic/OWNER/REPOSITORY/dart/
version: PACKAGE_VERSION
dependencies:
DEPENDENCY_NAME:
hosted:
name: PACKAGE_NAME
url: https://token:[email protected]/basic/OWNER/REPOSITORY/dart/
version: PACKAGE_VERSION
Installing a Package
Once set up, pub will download the dependency to .pub_cache
and update the pubspec.lock
and .packages
after running following command:
pub get
Configuration Example
A complete (but minimal) example of a pubspec.yaml
file specifying a dependency that is hosted in a public Cloudsmith repository would look like:
name: dart_demo_project
dependencies:
cloudsmith_dart_example:
hosted:
name: cloudsmith_dart_example
url: https://dl.cloudsmith.io/public/cloudsmith/examples/dart/
version: 1.0.15779875111116
Please also see the pubspec docs for further examples of pubspec files.
Upstream Proxying / Caching
Not Supported
Key Signing Support
Not Supported by Format
Troubleshooting
Please see the Troubleshooting page for further help and information.
Updated about a month ago