0

I installed flutter on a machine with a network, all tests and commands ( doctor, create, test ) run without problems. Then he took the directory where flutter was located and transferred it to a machine without an Internet connection. But with any call to flutter, it goes into

Running "flutter pub get" in flutter_tools.."

And does not leave this process. If you run it with the -vv flag, you can see that there is Resolving dependencies... The --offline flag does not help. I also tried to take .config, .pub-cache, .flutter from the machine where there is a connection and transfer it to the working one, but this did not help either. The question is, is there anything else that can be dragged and dropped as a dependency, or is there another way to run flutter offline?

Both machines are running Debian 9.

larcanus
  • 11
  • 3
  • If its first install flutter needs to get its dependencies. You do need an internet connection for this. – griffins May 23 '22 at 06:36
  • Yes. But if you transfer flutter with already obtained dependencies? Wouldn't it work there? – larcanus May 23 '22 at 06:39
  • No. If you browse the flutter directory you will see a packages folder. Just like your app needs to run flutter pub, so does flutter packages – griffins May 23 '22 at 06:41
  • I need to run and work with it without internet. I think there is a way... – larcanus May 23 '22 at 06:50
  • I use windows build , I include all the package I need, and do pug get, just run once. Then I am able to build window the rest of the time without worrying about internet. Don't use clean command mid-time. Also, if you are using others API that depends on runtime Internet, you need to have net :). – Md. Yeasin Sheikh May 23 '22 at 07:00
  • Unfortunately, I don't have internet on my working Debian. And the only option is to transfer dependencies from an already working flutter. But how and what? – larcanus May 23 '22 at 07:06

1 Answers1

1

As I thought, all this is possible. The problem is in the wrong paths. When transferring the flutter working directory to another PC, you need to make sure that the paths are identical. Because in *packages/flutter_tools/ files there are many links in files on paths that correspond to downloads from the first machine.

Total what needs to be done:

  1. Update flutter and dart
  2. Run flutter precache
  3. Copy the entire directory where flutter is located and ~$HOME/.pub-cache
  4. Create the same path on the new machine and transfer the files.
  5. Perform all necessary operations with the --offline flag
Moustapha
  • 108
  • 10
larcanus
  • 11
  • 3