I came across several plugins with the following structure:
my_plugin/
my_plugin_platform_interfance/
my_plugin_web/
README.md
Inside the main implementation, the file my_plugin/pubspec.yaml depends on both:
my_plugin_platform_interface: ^1.0.3
my_plugin_web: ^1.0.10
But I need to make change in both my_plugin_platform_interface and my_plugin_web.
I am not sure if this is the correct thing to do (but it feels wrong): I just commented these two lines and replaced with:
Please tell me if there is a proper way than this
my_plugin_platform_interface:
path: ../my_plugin_platform_interface/
my_plugin_web:
path: ../my_plugin_web/
I finished the change but I am not willing to publish it to dart pub. I just want to use it as a git repo directly.
So in my project I added:
my_plugin:
git:
url: git://github.com/TSR/my_plugin.git
ref: my/branch
path: my_plugin
But now I get the following error:
Flutter pub get
Running "flutter pub get" in my_project...
Error on line 18, column 11: Invalid description in the "my_plugin" pubspec on the "my_plugin_platform_interface" dependency: "../my_plugin_platform_interface/" is a relative path, but this isn't a local pubspec.
╷
18 │ path: ../my_plugin_platform_interface/
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
pub get failed (65; ╵)
exit code 65
So does this mean I should also edit my plugin dependency to
my_plugin_platform_interface:
git:
url: git://github.com/TSR/my_plugin.git
ref: my/branch
path: my_plugin_platform_interface
my_plugin_web:
git:
url: git://github.com/TSR/my_plugin.git
ref: my/branch
path: my_plugin_web
This feels even more wrong. Can someone tell me if there is a proper way to do this
Related
I want to clone a repository to my github account Repository link, then I want to make changes to the code and use the updated project in my vs code project.
For now i have only forked the repository and using it like this
dependencies:
hive: ^2.2.3
hive_flutter: ^1.1.0
flutter:
sdk: flutter
flutter_osm_plugin:
git:
url: https://github.com/tulip/osm_flutter
#flutter_osm_plugin: ^0.42.0
I get the following errors
[rider] flutter pub get
Waiting for another flutter command to release the startup lock...
Running "flutter pub get" in rider...
Resolving dependencies...
Error on line 20, column 11: Invalid description in the "flutter_osm_plugin" pubspec on the "flutter_osm_interface" dependency: "./flutter_osm_interface" is a relative path, but this isn't a local pubspec.
╷
20 │ path: ./flutter_osm_interface
│ ^^^^^^^^^^^^^^^^^^^^^^^
╵
pub get failed
command: "/Users/pannam/development/flutter/bin/cache/dart-sdk/bin/dart __deprecated_pub --directory . get --example"
pub env: {
"FLUTTER_ROOT": "/Users/tulip/development/flutter",
"PUB_ENVIRONMENT": "vscode.dart-code:flutter_cli:get",
"PUB_CACHE": "/Users/tulip/.pub-cache",
}
exit code: 65
exit code 65
Do i need to create a local repo in my device, using Mac, if so can you please let me know where i am going wrong? I tried searching in the internet and followed the steps but to no vail.
I review your issue. Try the below thing inside your plugin's pubspec.yaml.
dependencies:
flutter_osm_interface:
git:
url: https://github.com/jesussmile/osm_flutter/tree/master/flutter_osm_interface
I am currently working on an old flutter project. I want to install the necessary dependencies so that i can start making changes.
Now when i run the flutter pub get command, i get a certain error which is not explaining how to solve it.
pub get failed (server unavailable) -- attempting retry 10 in 64 seconds...
Git error. Command: git clone --mirror git://github.com/tekartik/platform.dart C:\src\flutter2\.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000
stdout:
stderr: Cloning into bare repository 'C:\src\flutter2.pub-cache\git\cache\platform.dart-6f0f0462856ed9b1246d3c594e824b1b2d81f000'...
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Unknown error
I think the point reached for downloading the dependency and it is not showing me where i can change from git:// to git#github
Below is a code snippet of the pubspec.yaml file where the dependency is to be installed
tekartik_app_platform:
git:
url: git#github.com:tekartik/app_flutter_utils.dart.git
ref: null_safety
path: app_platform
version: '>=0.1.0'
I am trying to get help on how to solve it because i only just got the code which is an old code and so am not sure where to go and make the fix.
Thank you alot in advance.
Try changing it to:
git:
url: https://github.com/tekartik/app_flutter_utils.dart
path: app_platform
ref: null_safety
More info on the packages can be found under: Dependencies on unpublished packages
https://docs.flutter.dev/development/packages-and-plugins/using-packages
I managed to find the solution. The ref value the project was using is null safety which still uses "git://" which is not being used by github anymore and so that is where the error is coming from.
So i changed to
tekartik_app_platform:
git:
url: git#github.com:tekartik/app_flutter_utils.dart.git
ref: dart2_3
path: app_platform
version: '>=0.1.0'
If this is the case for adding the plugin dependecy in flutter by git reference
Make sure you have public access for the same repository. if private then go to bottom of general setting and make it public.
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.
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
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.
In Flame we have a monorepo with Flame and its bridge packages and all of the bridge packages has Flame as a path dependency (not when they are released). It doesn't seem to be possible to depend on our main branch and on a bridge library on the main branch at the same time, I have this in the pubspec.yaml file:
dependencies:
flutter:
sdk: flutter
flame:
git:
url: git#github.com:flame-engine/flame.git
path: packages/flame
ref: main
flame_fire_atlas:
git:
url: git#github.com:flame-engine/flame.git
path: packages/flame_fire_atlas
ref: main
dependency_overrides:
flame:
git:
url: git#github.com:flame-engine/flame.git
path: packages/flame
ref: main
When doing pub get I get:
Error on line 15, column 11: Invalid description in the "flame_fire_atlas" pubspec on the "flame" dependency: "../flame" is a relative path, but this isn't a local pubspec.
╷
15 │ path: ../flame
│ ^^^^^^^^
╵
pub get failed (65; ╵)
which indicates that the dependency_override wasn't used, is it not possible to override path dependencies?
Apparently this is a bug in pub, the only way to solve it for now is to clone the dependencies that you need to the path that the packages expect them.
So in this case I would have to clone the branch of flame that I want to use to ../flame, in relation to the projects pubspec file.
see this this solution it may help you.
Found this article, that seems like it would give sufficient instructions for using forked versions of many pub packages.
However, the package I want to fork (scrollable_positioned_list) is a part of a the flutter.widgets repository, which is not a package itself, but a collection of packages.
I've been able to fork and modify the package, my trouble is being able to use my fork in my project.
I've tried the obvious:
dependencies:
flutter:
sdk: flutter
scrollable_positioned_list:
git:
url: https://github.com/bendelonlee/flutter.widgets
This causes flutter pub get to fail with the error:
pub get failed (1; Could not find a file named "pubspec.yaml" in https://github.com/bendelonlee/flutter.widgets 1f2935687390a9315c3336007a4eac00563365a4.)
Indeed, there is no pubspec.yaml in the root of that directory, though there is one nested in the package.
I've also tried using the url of the package inside the repository
scrollable_positioned_list:
git:
url: https://github.com/bendelonlee/flutter.widgets/tree/master/packages/scrollable_positioned_list
This fails with an error complaining that the repository isn't found:
fatal: repository 'https://github.com/bendelonlee/flutter.widgets/tree/master/packages/scrollable_positioned_list/' not found
The path argument should be added just as the official docs state:
Pub assumes that the package is in the root of the Git repository. To specify a different location in the repo, use the path argumen
In your specific cace this would be
scrollable_positioned_list:
git:
url: https://github.com/bendelonlee/flutter.widgets
path: packages/scrollable_positioned_list