5

Is there no way to manually download a package and install it? It's so frustrating using their package manager which this time downloads in 0.4 seconds but the next cannot download ever after multiple tries waiting several minutes each time. It's just so unreliable.

Is there at least a way I can see a progress bar on it or something? It just seems ridiculous to have so much trouble downloading something that I could download in 2 seconds in my browser and it would be successful every single time.

I've wasted half the day just trying to download a package so I can continue with my project because of this. It's just rflutter_alert...I mean how big can it really be?

Hasen
  • 11,710
  • 23
  • 77
  • 135

4 Answers4

7

To extend from the other answer, the complete procedure is to download the packages from github and on Mac, to place them in the folder users/*username*/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/. For windows I'm unaware of the location of these packages.

You will also need to change the name from rflutter_alert-master to rflutter_alert-1.0.3 and add the correct version number in.

From there if you run flutter pub get it will successfully complete no problem because there is nothing to download.

Hasen
  • 11,710
  • 23
  • 77
  • 135
  • I know this is an old post but I am having the same issue. What's the exact path of `Developer/flutter/.pub-cache/hosted/pub.dartlang.org` I cannot find it. Any help is appreciated thanks! – fraser dale May 05 '20 at 00:14
  • @fraser dale Updated my answer with the full path. You'll need to view invisible files to see the folders with a full stop before them. Use CMD+SHIFT+. to view invisible files. – Hasen May 06 '20 at 06:11
  • Here on windows 11 ```c:\users\[your profile name]\AppData\Pub\Cache\hosted\pub.dartlang.org``` – Ebena107 Sep 26 '21 at 04:39
3

For Windows users it is:

C:\Users\Username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
2

2020 Flutter 1.20.3 Official documents - Dependencies on unpublished packages:

Path dependency A Flutter app can depend on a plugin via a file system path: dependency. The path can be either relative or absolute. Relative paths are evaluated relative to the directory containing pubspec.yaml. For example, to depend on a plugin plugin1 located in a directory next to the app, use the following syntax:

 dependencies:
   plugin1:
     path: ../plugin1/

https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages

2020

Kai
  • 149
  • 2
  • 5
0

You could, in theory, download the packages from GitHub and then use them locally. However, this is not recommended, as you won't get any updates. Did you check if there might be another reason for this? I never had issues like this.

FN2187
  • 123
  • 2
  • 7
  • Well yes I live in China, I'm sure that's something to do with it but I still think there should be alternatives. At the very least it should have a progress bar so I have some idea if it's going or not. How do you actually install the packages from github though? I think your answer should be a comment really, but if you can give some instructions how to install them it could be a good answer. – Hasen Aug 14 '19 at 10:37
  • First, I can't add comments because of low reputation so far. Second, you can download the repository from GitHub. mostly the files that are actually used are only the ones in the lib-folder. – FN2187 Aug 14 '19 at 10:44
  • Ok fair enough, but where do you put them in your project folder? They don't appear to be in the project folder in fact. Have you tried this and does it work? It would be great if it really does. – Hasen Aug 14 '19 at 11:05
  • They appear to be in `Developer/flutter/.pub-cache/hosted/pub.dartlang.org/`. I'll try just putting a package in there and see what happens. – Hasen Aug 14 '19 at 11:08
  • It works! My god the package is only 235k! Why in the world can't the package manager download such a ridiculously small file...Anyway, just update your answer to detail where to put the packages etc and I can accept it as the answer. – Hasen Aug 14 '19 at 11:20
  • Afaik you can just put the files basically anywhere. I think I put them just in my lib-folder. I actually don't know where you found this Developer-folder you're talking about. You have to change the import though, depending on where you put them. – FN2187 Aug 14 '19 at 12:55
  • Not sure if that's correct, since none of the currently installed packages are in the lib folder. The packages are a folder with many files so it'd be weird to have them in the lib folder anyway. Not to mention that I wouldn't know how Flutter would archive them when you make a build, it may add to the size of your app. – Hasen Aug 16 '19 at 05:41
  • I know they aren't there by default, but you can put them there. I think you could even create a folder of any name somewhere and put them there. You just need to reference them correctly, I think. I never tried this though, so it's only how I think it works. – FN2187 Aug 16 '19 at 15:07
  • To be honest, I think you're putting them in the lib folder, then running `flutter pub get` and they're just getting downloaded by the package manager to the folder I mentioned, and your project is using them from there. Since you say you never had any problems with package manager, so it will just download them for you anyway. But in any case, your basic idea of downloading them from github does work. – Hasen Aug 18 '19 at 05:39