flutterpackageazure-artifactshosted

How to reference a custom flutter package published as universal package in Azure devops feed


So i have developed a package say A and published in Azure devops > Artifacts >Universal Package. In my pubspec.yaml file of the project i am referring it as

`dev-dependencies
A:
  hosted:
    url: https://feeds.dev.azure.com/{organization}/{projectname}/_apis/packaging/Feeds/{feedname}/Packages/
    path: packageA
    ref: v1.0.0`

Reference : https://dart.dev/tools/pub/dependencies#hosted-packages (Hosted PAckage in custom repo) I have also created a PAT token and set as environment variable. also used command as below dart pub token add https://feeds.dev.azure.com --env-var MY_SECRET_TOKEN MY_SECRET_TOKEN is saved in environment variable.

I get an issue: Because flutter_appp_Example depends on package 'A' any which doesn't exist (could not find package A at https://feeds.dev.azure.com/{organization}/{projectname}/_apis/packaging/Feeds/{feedname}/Packages/)

I am expecting that it refers the package from the repository directly and i dont have to run command for downloading universal package which looks like below:

az artifacts universal download --organization https://dev.azure.com/ericsson/ --project="Integrated_Service_Flow" --scope project --feed Mobile_Feed --name my-first-package --version 0.0.1 --path .


Solution

  • I'm afraid it's not supported to use DevOps universal package in the pubspec.yaml file of your flutter project.

    The dependencies sources in pubspec.yaml support below:

    enter image description here

    And for Hosted packages, it supports custom package repository. The package should be able to fetch from the hosted-url. enter image description here

    However, DevOps Univeral feed package is NOT stored in the git repository, and cannot fetch from the feed package url. Hence, cannot use the hosted-url as the sample above.