How to solve the error on outdated code when cloning - flutter

I am recently want to see and run some other developers code in github and clone it to run in my emulator but it showing some error like this
"Running "flutter pub get" in budgex...
Because budgex depends on basic_utils from path which doesn't exist (could not find package basic_utils at "..\packages\basic-utils-3.3.3"), version solving failed.
pub get failed (66; Because budgex depends on basic_utils from path which doesn't exist (could not find package basic_utils at "..\packages\basic-utils-3.3.3"), version solving failed.)"
i am was trying to install basic_utils package but seem failed how to solve this problem?

Click on the link to get packages in the given environment like VS code, or save your code while pubspec.yaml file is opened – it will get flutter packages for you automatically.

The error says that you are trying to use a library on your local computer: basic_utils; the pub command is searching it in the path ..\packages\basic-utils-3.3.3 but it can't find the library there.
In the pubspec.yaml you should have something like this:
basic_utils:
path: ..\packages\basic-utils-3.3.3
You should be ok replacing this with:
basic_utils: 3.3.3
If the developer has made changes to the library you should ask him the changed library and then update the pubspec with the correct location like described here.

Related

Trying to do a flutter pub get and got Process finished with exit code 66

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/

Flutter Error : Package io.flutter.plugins.webviewflutter does not exists

I get an error message while running a Flutter project. I tried using webview_flutter(1.0.7) plugin with Flutter 1.22.5(stable) and Flutter 1.26.0-2.0.pre.167.
This is a fresh new project with only webview_flutter plugin dependency.
I am getting the above error that package webviewflutter does not exists.
Please help to solve this issue.
You may want to check if you made the correct entry for the package in your pubspec.yaml and after that does get run successfully.
Just a tip:
It is better to paste the error text, rather than a screenshot.

Flutter - Overridden dependencies

After running "flutter pub get", I got this error:
Warning: You are using these overridden dependencies:
! path 1.6.4
That's not an issue. That happens because you (or any other transitive dependency) may be overriding some dependency that you are already using. For example, if you are using path: 0.X.X and some other dependency use dependency_overrides to make sure that is using path: 1.6.4, it will present you that message.
Overall, you shouldn't have to worry with that and sometimes it is actually required in order to some dependencies work all together.
Please give more details so that i can answer it better. Attach your pubspec.yaml.
But now i can tell you some methods which should work..
first of all see if you are using the latest version of all dependencies or not then:
try:
restarting your ide
flutter clean
if these two don't work then at last try
flutter pub cache repair
I encountered the same error after cloning a flutter repository. I initially mistook the error for being a build issue when it's just a warning that won't stop your app from running.
I solved the build issue I was having with the freshly cloned project by running this command inside the app's root directory: flutter pub run build_runner build

Unable to create flutter project

When running flutter create followed by project name, I receive this error:
Error: Error when reading '../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No such file or directory
Running "flutter pub get" in pics...
pub get failed (254; Error: Error when reading
'../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No
such file or directory)
I'm trying to create a new flutter project in xcode. How would I fix this?
'../documents/flutter/bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot': No
such file or directory
It seems like there may be files missing from your Flutter SDK. There should be a file in the Flutter SDK at bin/cache/dart-sdk/bin/snapshots/pub.dart.snapshot but this error suggests it's missing.
The easiest fix may be to delete the bin/cache folder which will cause Flutter to re-download the Dart SDK and other components when you next run flutter. This may take a little while depending on your connection, but is the simplest way to ensure the cache folder is complete. I would suggest closing all IDEs/editors when doing this.
I have same issue but the problem was windows defender at real time detection so the solution was to switch off it then create a project...

The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated

I'm running a dart only test in intellij and receiving the following error:
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "pub get" again.
I have tried pub get a number of times. Any ideas? I'm on the dev branch of Flutter (anything using Dart 2.7 pretty much fails with the same or a similar error message).
Edit
I think that if you have a path reference dependency in the pubspec.yaml file it will fail.
Anything like the following fails with the above message if you try to run a dart test in IntelliJ.
dependencies:
test_dependency:
path: ../test_dependency
I'm not suggesting this is a fix for everyone, but it did resolve my particular situation.
Just ran into this error after upgrading flutter from 1.22.6 to 2.0.2 and trying to use build_runner: ^1.12.2 and json_serializable: ^4.1.0 to generate json serialization/deserialization classes & methods.
The problem is apparently related to the pub package when used with relative paths for packages as noted in the following github issues:
https://github.com/dart-lang/pub/issues/2806
https://github.com/dart-lang/pub/pull/2830
One of the commenters in issue 2806 mentioned running flutter create . inside the flutter project folder which rebuilds .dart_tool/package_config.json, adding any missing entries, solving the problem.
No one solved this problem so far?
I've found a staightforward solution and it works fine for me.
You need to close your IDE (VSCode in my case), make sure that is completely closed using process-monitor.
Then open a terminal window manualy in your project folder and run "flutter pub get"
After that just start your IDE normaly and ewerything will work fine.