Dart Repository
Cloudsmith provides public & private repositories for Dart packages
Dart SDK
Dart SDK version >= 2.15 is required to use Dart Repositories.
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 organization 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
Publish via Dart
Please note that Dart SDK version 2.15.1 or newer is required for native upload support. For older client versions, please continue to use the Cloudsmith CLI/API.
The endpoint for the native Dart API is:
https://dart.cloudsmith.io/OWNER/REPOSITORY/
Your project pubspec.yaml
defines the location that artifacts should be published to. Add the following to the root of this file:
publish_to: https://dart.cloudsmith.io/OWNER/REPOSITORY/
In order to authenticate for native publishing, you'll need run dart pub token
, as follows:
echo 'API-KEY' | dart pub token add https://dart.cloudsmith.io/OWNER/REPOSITORY/
Enter secret token:
Requests to "https://dart.cloudsmith.io/OWNER/REPOSITORY/" will now be authenticated using the secret token.
You can then publish from your project directory using dart pub publish
:
dart pub publish
Uploading...
Upload complete. Package will available following synchronisation.
Limitation:
When publishing via the native API package sizes are limited to 200.0 MB per file. If this is an issue, please use the Cloudsmith CLI or API (which support up to 5GB for single-part uploads and beyond for multi-part), or contact us if that's not an option.
Upload via the Cloudsmith CLI
Please see Dart's documentation on creating packages for more information on building your own packages.
Creating Dart Packages
To upload via the Cloudsmith API/CLI, you'll need to generate a package first. While we expect the tooling in this area to improve over time, currently the process is a manual one and can be a little tricky.
You can build a package with standard command-line tooling like tar
. To illustrate the process we'll use cli_util as an example:
First, check out the version of cli_util we want to pack (v0.1.3 for example purposes):
git clone https://github.com/dart-lang/[email protected]
cd cli_util
tar --exclude='.dart_tool' -czvf cli_util_0.1.3.tar.gz ./*
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
Public Repositories
No further setup is required with public repositories, you can add a dependency from this repository to your package pubspec.yaml
automatically with dart pub
. See Installing a Package
Private Repositories
In order to authenticate, you need to run dart pub token
, as follows:
echo 'TOKEN' | dart pub token add https://dart.cloudsmith.io/OWNER/REPOSITORY/
Enter secret token:
Requests to "https://dart.cloudsmith.io/OWNER/REPOSITORY/" will now be authenticated using the secret token.
echo 'PASSWORD' | dart pub token add https://dart.cloudsmith.io/OWNER/REPOSITORY/
Enter secret token:
Requests to "https://dart.cloudsmith.io/OWNER/REPOSITORY/" will now be authenticated using the secret token.
echo 'API-KEY' | dart pub token add https://dart.cloudsmith.io/OWNER/REPOSITORY/
Enter secret token:
Requests to "https://dart.cloudsmith.io/OWNER/REPOSITORY/" will now be authenticated using the secret token.
echo 'TOKEN' | dart pub token add https://dart.cloudsmith.io/OWNER/REPOSITORY/
Enter secret token:
Requests to "https://dart.cloudsmith.io/OWNER/REPOSITORY/" will now be authenticated using the secret token.
Installing a Package
dart pub
is capable of adding a dependency from this repository to your package pubspec.yaml
automatically:
Public Or Private Repositories
dart pub add PACKAGE_NAME:PACKAGE_VERSION --hosted-url https://dart.cloudsmith.io/OWNER/REPOSITORY/
Resolving dependencies...
+ your-package 1.2.3
Downloading your-package 1.2.3...
Changed 1 dependency!
Please also see the pubspec docs for further examples of pubspec files.
Security Scanning
Supported
Please see our Security Scanning documentation for further information.
Upstream Proxying / Caching
Configurable Proxying Caching
You can configure upstream Dart repositories that you wish to use for packages that are not available in your Cloudsmith repository. Proxied Dart packages cannot currently be cached.
Please see our Upstream Proxying documentation for further instructions.
Key Signing Support
Not Supported by Format
Troubleshooting
Please see the Troubleshooting page for further help and information.
Updated 14 days ago