Building a Flutter macos app on a CI/CD macos node where internet access is restricted

Hi,
I am trying to build a Flutter macOS app on a CI/CD macOS node (Intel-based) with restricted internet access. Websites like pub.dev and storage.googleapis.com are not accessible.

I have a physical Intel-based Mac where everything works as expected—Flutter SDK is installed, the app builds successfully, and the .pub-cache directory is already created.

Steps I have taken so far:

  1. Copied the ~/development/flutter folder from the physical Mac to the same path on the CI/CD macOS node.
  2. Copied the ~/.pub-cache directory to the CI/CD macOS node.
  3. Added below lines in ~/.zshenv on CI/CD macOS

export PATH=$HOME/development/flutter/bin:$PATH
export PUB_CACHE=~/.pub-cache

Only these two command working:

flutter --no-version-check --version and dart --no-version-check --version

Any other below commands gets struck forever.

flutter --no-version-check clean -v
flutter --no-version-check pub get --offline -v
flutter --no-version-check build macos --release -v

It struck at this log, refer attached screen shot for more details:

/Users/faisal/development/flutter/bin/cache/dart-sdk/bin/dart
pub --suppress-analytics --color -verbose --directory …/…/…/…/development/flutter/packages/flutter_tools get --example

How can I ensure that a Flutter macOS app builds successfully on a CI/CD node with restricted internet using the Flutter SDK and pub-cache copied from another working Mac?