How to reference packages from repository in Flutter?

2,241

That's because that's a repo with multiple packages. You need to reference the path and branch directly, just like so, for example for the master branch:

graphql_flutter:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql_flutter

If you want both packages:

graphql_flutter:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql_flutter

graphql:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql
Share:
2,241
flutter
Author by

flutter

Updated on December 28, 2022

Comments

  • flutter
    flutter over 1 year

    I'm trying to modify an existing package on pub.dev. I need to update one of the dependencies in the package. I've seen how to do this from here

    dependencies:
      flutter:
        sdk: flutter
      graphql_flutter:
        git:
          url: https://github.com/username/graphql-flutter.git
    

    When I run flutter pub get
    I get pub get failed (1; Could not find a file named "pubspec.yaml"

    Looking at the repository

    There is no pubspec.yaml in the root

    I presume I need to reference the pubspec.yaml in the packages folder? There is 2 of them there... Not sure how to do this?

    The package is graphql_flutter

  • flutter
    flutter about 3 years
    cheers, how would add the 2 paths for the 2 packages?