0

After updating my flutter version to the latest version (version 3.10.5), some of the files from one of my packages had code that was deprecated, and stopped the program from running. What is strange is that these folders were all located in a different directory that I have never seen before. I will copy the path of one of the files for reference:

/Users/alex_1/.pub-cache/git/flutter_paystack-a4a33c3dd0a12f46d655a2e63d11e9f20ba82d01/lib/src/widgets/buttons.dart

In order to get my project to run, I had to change some of the code in these files. Specifically, I had to replace the deprecated code with the new supported code.

enter image description here

What I don't understand is that these files are not even in my project folder. They are in the directory specified above. Furthermore, I can't push these changes to the Github repository of my project. While editing the folder, I get this warning:

enter image description here

I also see this pop up:

enter image description here

Please can someone explain what this .pubcache folder is, and why it contains files that affect my project - but aren't actually in my project.

Here is the package in the Pubspec.yaml:

enter image description here

I would really appreciate it, thanks!

Lex
  • 61
  • 6

1 Answers1

0

the pub-cache folder is your system cache where all dart and flutter packages are downloaded to that any of your projects depend on.

In your pubspec.yaml you depend on a version range of a specified package and your pubspec.lock file is auto generated and contains the exact version of a package that your project uses (which will be matched to the version of the package downloaded inside of your pub cache folder).

Also is there any reason you depend on a specific commit of the github repository with the ref param? You wont get any automatic updates by using a ref.

As for the deprecation itself, it would be best to change the Theme.of(context).accentColor to Theme.of(context).colorScheme.secondary for the same functionallity instead of using a hard coded color.

Niko
  • 550
  • 1
  • 6
  • Ahh okay I see, makes sense. So then what will ahppened if I remove ref? will it automatically pull the latest files from the Paystack repository? Furthermore, will it overwrite the current files? – Lex Jul 14 '23 at 14:04
  • Yes, the next time you execute `pub get` inside of your repository. But i think your `ref` is currently still on the recent version of the package – Niko Jul 14 '23 at 19:31