Dart
Prerequisites
Ensure you have the Dart CLI
dartand Flutter CLIflutterinstalled on your local machine.Access to a Harness account with appropriate permissions to create registries and connectors.
Create a Dart artifact registry
Navigate to the Artifact Registry module in your Harness project.
Click on New Artifact Registry.
In the Registry Type dropdown, select Dart Registry.
Provide a Registry Name.
Your registry name must start with a letter and can include
lowercase alphanumerics,_,.and-.
Optionally, add a Description and Labels for better organization.
Choose visibility between Public and Private. By default, the visibility is set to Private.
Click Create Registry to finalize.
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
In the Artifact Registry module, click the dropdown next to New Artifact Registry and select Upstream Proxy.
Choose Dart Registry as the proxy type.
Click Create Proxy to establish the connection.
Configure the upstream proxy in your registry
In the Artifact Registry module, select an existing Artifact Registry.
Select the Configuration tab.
Under Advanced (Optional), select Configure Upstream.
Select from the list of compatible proxies to add them to your registry.
Click Save to save the configuration.
Install and Use Dart Packages
Configure Authentication
Step 1
Add authentication token to Dart pub:
Step 2
Enter your <TOKEN> when prompted.
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.
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?