For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dart

spinner

Prerequisites

  • Ensure you have the Dart CLI dart and Flutter CLI flutter installed on your local machine.

  • Access to a Harness account with appropriate permissions to create registries and connectors.


Create a Dart artifact registry

Create Artifact Registry in Harness
  1. Navigate to the Artifact Registry module in your Harness project.

  2. Click on New Artifact Registry.

  3. In the Registry Type dropdown, select Dart Registry.

  4. Provide a Registry Name.

    • Your registry name must start with a letter and can include lowercase alphanumerics, _, . and -.

  5. Optionally, add a Description and Labels for better organization.

  6. Choose visibility between Public and Private. By default, the visibility is set to Private.

  7. Click Create Registry to finalize.

PRIVATE REGISTRY

This registry will serve as your private Dart registry within Harness.


Configure an Upstream Proxy (Optional)

An upstream proxy allows your registry to fetch NuGet packages from external sources if they are not available locally.

Create an upstream proxy

Configure Upstream Proxy in Harness

Configure the upstream proxy in your registry

Configure Upstream Proxy in Harness

Create an upstream proxy

  1. In the Artifact Registry module, click the dropdown next to New Artifact Registry and select Upstream Proxy.

  2. Choose Dart Registry as the proxy type.

  3. Click Create Proxy to establish the connection.

Configure the upstream proxy in your registry

  1. In the Artifact Registry module, select an existing Artifact Registry.

  2. Select the Configuration tab.

  3. Under Advanced (Optional), select Configure Upstream.

  4. Select from the list of compatible proxies to add them to your registry.

  5. Click Save to save the configuration.

UPSTREAM PROXY CACHING

If a Dart package isn't found in your Harness registry, the upstream proxy automatically fetches it from an external source like pub.dev. The package is then cached in your registry, ensuring faster downloads for subsequent requests.


Install and Use Dart Packages

Configure Authentication

Step 1

Add authentication token to Dart pub:

Step 2

Enter your <TOKEN> when prompted.

Replace <account-id> with your Harness account ID and <dart-registry-name> with your registry name.

Install a Dart Package

Step 1

In your consuming project's pubspec.yaml, add the dependency pointing to the hosted URL:

Step 2

Then fetch it:

Publish a Dart Package

Step 1

In your package's pubspec.yaml, set the registry URL:

Step 2

Then run:

Configure Authentication

Step 1

Add authentication token to Flutter pub:

Step 2

Enter your <TOKEN> when prompted.

Replace <account-id> with your Harness account ID and <dart-registry-name> with your registry name.

Install a Dart Package with Flutter

Step 1

In your Flutter project's pubspec.yaml, add the dependency pointing to the hosted URL:

Step 2

Then fetch it:

Publish a Dart Package with Flutter

Step 1

In your Flutter package's pubspec.yaml, set the registry URL:

Step 2

Then run:

Last updated

Was this helpful?