i created a flutter package using the command
flutter create --template=package my_query
And it works fine, now i wanna use this package on my other application.
I added my package on the dependecies and also the path
dependencies:
flutter:
sdk: flutter
my_new_package:
path: ./Users/Name/Desktop/Flutter/my_query
error message:
pub get failed (66; Because flutter_email depends on couch_db from path
which doesn't exist (could not find package couch_db at
"./Users/Name/Desktop/Flutter/my_query"), version solving failed.)
exit code 66
This is the directory of my package
C:\Users\Name\Desktop\Flutter\my_query
How to do the path correctly?
try to set the path to your package in relation to the location of your pubspec.yaml file.
E.g. if your folder flutter-projects contains a folder with flutter-app and your package my-query, try referencing my-query in your pubspec.yaml like this:
dependencies:
my-query:
path: ../my-query
Let me know if this solved your issue!
Related
I'm trying to use flutterfire_ui for authentication in a flutter app. The developer (invertase) has committed a pull request 9343 on github that fixes some problems. I have pulled it into a local GIT folder. It includes some reorganization of folders, including a package name change - firebase_ui_auth instead of flutterfire_ui. I have changed my local pubspec.yaml to use all the firebase packages in PR 9343 but I get an error with "pub get" as follows that I am unable to resolve.
Running "flutter pub get" in firebase_with_flutter...
Because every version of firebase_ui_oauth from path depends on firebase_ui_auth from hosted and firebase_with_flutter depends on firebase_ui_auth from path, firebase_ui_oauth from path is forbidden.
So, because firebase_with_flutter depends on firebase_ui_oauth from path, version solving failed.
pub get failed (1; So, because firebase_with_flutter depends on firebase_ui_oauth from path, version solving failed.)
In pubspec.yaml I have entered an explicit path to all of the PR9343 firebase packages
firebase_core:
path: C:/GP/project/git-remote/flutterfire/packages/firebase_core/firebase_core/
cloud_firestore:
path: C:/GP/project/git-remote/flutterfire/packages/cloud_firestore/cloud_firestore/
firebase_auth:
path: C:/GP/project/git-remote/flutterfire/packages/firebase_auth/firebase_auth/
firebase_ui_auth:
path: C:/GP/project/git-remote/flutterfire/packages/firebase_ui_auth/
firebase_ui_oauth:
path: C:/GP/project/git-remote/flutterfire/packages/firebase_ui_oauth/
In main.dart android studio reports "invalid URI" for this import
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
https://github.com/firebase/flutterfire/tree/master/packages/flutterfire_ui
Does anyone have any idea what I am doing wrong?
If I add explicit paths to the pubspec.yaml files in my local git repo just as I have for my own pubspec.yaml file then it works and pub get runs without error. So now I have this
firebase_auth:
path: C:\GP\project\git-remote\flutterfire\packages\firebase_auth\firebase_auth\
instead of this
firebase_auth: ^3.6.2
How come it works for the Invertase developer without using path settings and not for me. As well as that, the firebase_auth package is in a "deeper folder"
C:\GP...\packages\firebase_auth\firebase_auth\ than it was before and if I leave off the inner \firebase_auth from the path it doesn't work.
Maybe I'm supposed to use the git mechanism instead of an explicit path setting.
Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Process finished with exit code 66
/Users/H025712/development/flutter/bin/flutter --no-color pub get
Running "flutter pub get" in mobile...
Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.
pub get failed (66; Because mobile depends on charts_flutter from path which doesn't exist (could not find package charts_flutter at "../mobile-dependencies/pub.dartlang.org/charts_flutter-0.12.0"), version solving failed.)
Cause: Someone in your team (could be yourself) add a plugin from their local folder. This plugin can't be found when you try to update the dependency.
Quick fix: If you use remote git, let you teammate include that plugin in the project folder, modify the pubspec.yaml path, add it to stage, commit then push. In the case not using git remote, copy those files to your computer in the path as pub spec.yaml suggested.
Ideal fix: Let your teammate use public plugin or share that plugin in private with password, then let flutter download that plugin by flutter pub get/upgrade.
Check your pubspec.yaml is well ordered, I had badly composed dev_dependencies and it failed me
Talked to my tech lead, who is familiar with the code; he said to check out the missing code that was referencing overrides in the pubspec.yaml:
https://dart.dev/tools/pub/dependencies
Dependency overrides
You can use dependency_overrides to temporarily override all references to a dependency.
For example, perhaps you are updating a local copy of transmogrify, a
published library package. Transmogrify is used by other packages in
your dependency graph, but you don’t want to clone each package
locally and change each pubspec to test your local copy of
transmogrify.
In this situation, you can override the dependency using
dependency_overrides to specify the directory holding the local copy
of the package.
The pubspec would look something like the following:
name: my_app
dependencies:
transmogrify: ^1.2.0
dependency_overrides:
transmogrify:
path: ../transmogrify_patch/
I created an example project inside a my flutter package and inside my example project i did:
dependencies:
flutter:
sdk: flutter
my_package:
path: ../
my_package used rxdart and i received an error after run my example project
Error: Could not resolve the package 'rxdart' in
'package:rxdart/rxdart.dart'.
I ran flutter packages get but the error is still here.
I just ran into the same issue. To solve it follow these steps:
Kill your app if it's running
Run flutter clean in both your main project directory and your my_package directory
Run flutter pub get in both your main project directory and your my_package directory
Now when you build your app you should be all set.
Check first, if you added rxdart package to your pubspec.yaml as shown below:
dependencies:
flutter:
sdk: flutter
rxdart: ^0.24.1
Run flutter pub get
I'm very new to Flutter and I'm following the bloc Google login example so under dependencies: in the pubspec.yamlfile I put
flutter_bloc:
path: ../../packages/flutter_bloc
as in the downloaded project, but when I do get packages I get this error:
Because fixit_cloud_biking depends on flutter_bloc from path which
doesn't exist (could not find package flutter_bloc at
"../../packages/flutter_bloc"), version solving failed. pub get failed
(66; Because fixit_cloud_biking depends on flutter_bloc from path
which doesn't exist (could not find package flutter_bloc at
"../../packages/flutter_bloc"), version solving failed.)
What am I doing wrong?
Many thanks
This is because you don't have the package flutter_bloc on the route you are defining.
The examples folder where you got the example uses local references, so if you didn't clone the entire repository or you are simply copying some parts to replicate it you must change the package path.
This way you will no longer use the local reference to the package, or you can correct the route.
So change this:
dependencies:
flutter_bloc:
path: ../../packages/flutter_bloc
To this:
dependencies:
flutter_bloc: any
Please read this for more information.
You can specify paths using this example below. Obs: You need to respects spaces and break lines.
dependencies:
flutter_bloc:
path: ../../packages/flutter_bloc
I am new to flutter and SO, I tried this Flutter force higher package dependency version,
My code was
dependencies:
intl: ^0.15.0
I replaced it with
dependency_overrides:
intl: ^0.16.0
But I still get this error
$ flutter pub get
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Do not run this command from the root of your git clone of Flutter.
This isn't a pubspec issue. You're simply executing the command from the wrong directory.
cd into the directory where your flutter project files are. That will be the folder that contains other folders like, build, android, ios, lib along with the pubspec.yaml file. Run flutter pub get from there.
Go to the root of your project, where the lib and other directories exist. Then run the command. The best is to use the terminal of your code editor as the path would be same as root of your project in there.