How to reference packages from repository in Flutter?
Asked Answered
S

1

11

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

Shelled answered 16/3, 2021 at 21:30 Comment(0)
B
15

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
Beeman answered 16/3, 2021 at 22:3 Comment(1)
cheers, how would add the 2 paths for the 2 packages?Shelled

© 2022 - 2025 — McMap. All rights reserved.