Chung Heon
Chung Heon

Reputation: 67

Importing packages from GitHub in pubspec yaml, requires pubspec.yaml file which isnt in the repository

I have issues using flutter pub get with a repository package in my pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter

  flutter_stripe:
    git: 
      url: https://github.com/flutter-stripe/flutter_stripe.git
      ref: poc-use-expensive-androidview

Following the steps provided https://dart.dev/tools/pub/dependencies#git-packages.

However, I am getting the error

Could not find a file named "pubspec.yaml" in https://github.com/flutter-stripe/flutter_stripe.git 7934151fefed73c6a22c253de3a1f1c9d46decc2.
pub get failed (1; Could not find a file named "pubspec.yaml" in https://github.com/flutter-stripe/flutter_stripe.git 7934151fefed73c6a22c253de3a1f1c9d46decc2.)

I have no idea what I am suppose to put for the pubspec.yaml which is not present in the repository. And it works fine if you call the package as it is using flutter pub add flutter_stripe.

The reason I am required to use an unofficial branch is because one of the fields provided by the package is not working correctly, and the suggested solution is to use this branch.

Upvotes: 2

Views: 3043

Answers (2)

MCB
MCB

Reputation: 876

If you look at the packages of the git project you can see more then one package: https://github.com/flutter-stripe/flutter_stripe/tree/main/packages You have to choose the package(s) you need.

Upvotes: 0

Chung Heon
Chung Heon

Reputation: 67

Sorry, my bad, I didnt know that the root of the Hosted package isn't the final path. I was required to add a path to the packages, which can then be found in ./packages/stripe.

flutter_stripe:
    git: 
      url: https://github.com/flutter-stripe/flutter_stripe.git
      ref: poc-use-expensive-androidview
      path: ./packages/stripe

For anyone who has the same issue as me... or maybe i'm just noob

Upvotes: 5

Related Questions