Configure the Pub Client to Work With Artifactory

JFrog Artifactory Documentation

Products
JFrog Artifactory
Content Type
User Guide
ft:sourceType
Paligo

To use Artifactory with your Pub client, you will first need to set Artifactory as a Pub repository, and then deploy and resolve the relevant Dart/Flutter package, as described in this section.

Prerequisite

You will need to generate an authentication token. For more information, see Access Token Authorization Headers.Access Tokens

Step 1: Add Artifactory to your /etc/pub/repositories File

  1. Select the Platform tab and go to Artifactory->Artifacts.

  2. Select the desired repository.

  3. Select Set Me Up.

  4. In the Configure tab, add the repository to your client using the following command and run it.

    HTTPS-Mode Only

    Pub authentication to Artifactory is supported only through HTTPS-Only mode.

    setmeup_pub_configure.png

Step 2: Deploy Dart/Flutter Packages

Dart/Flutter packages can be deployed by one of the following three methods:

  • With cURL

  • Through the User Interface (UI)

  • Through the Command Line Interface (CLI)

Deploy Dart/Flutter Packages using the cURL

You can deploy a Dart/Flutter package into an Artifactory repository using the cURL as follows:

curl -u<USERNAME>:<TOKEN> -T <file>.tar.gz  " https://<YOUR_JFROG_DOMAIN>/artifactory/<REPO_NAME>/<PACKAGE_NAME>/<FILE>/<VERSION>.tar.gz"

Indexing Dart/Flutter Packages

For your files to be indexed properly, it is very important to ensure that all deployment of Dart/ Flutter packages into Artifactory occurs under the <REPOSITORY>/<PACKAGE_NAME/<FILE>/<VERSION> structure. Packages deployed anywhere else will not be indexed.

Deploy Dart/Flutter Packages through the User Interface

To deploy a Dart/Flutter package to Artifactory through the UI, do the following:

  1. Select the Platform tab and go to Artifactory->Artifacts.

  2. Select the Pub repository where you want to deploy the packages.

  3. Click the Deploy button in the upper right part of the screen. The Deploy window appears, as shown below.

    deploy_pub_package.png
  4. Click Drop File or Select File in the Deploy window and select the artifact that you want to deploy.

  5. In Target Path, you can specify the relative path for the target repository, or use the default path that Aritfactory assigns.

  6. Click Deploy.

Deploy Dart/Flutter Packages with the CLI

  1. In the CLI, go to your project and navigate to the directory that contains the pubspec.yaml file.

  2. Run the following command:

    dart pub publish

    This publishes your Dart package to your private Artifactory Pub repository, as defined in your configuration.

Step 3: Resolve Dart/Flutter Packages

To resolve Dart packages:

  1. In the CLI, go to your project and navigate to the directory that contains the pubspec.yaml file.

  2. Run the following command:

    dart pub get

    This will fetch all dependencies defined in pubspec.yaml, including packages hosted on your private Artifactory.