# Pub get failed (server unavailable) -- Could not resolve packages due to socket exception: OS Error: Connection refused

- **ID:** `flutter/install-error-pub-get-failed-socket`
- **Domain:** flutter
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

The pub.dev server or a custom package repository is unreachable due to network issues, firewall blocking, or DNS resolution failure.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| flutter 3.10 | active | — | — |
| flutter 3.22 | active | — | — |
| dart 3.0 | active | — | — |
| dart 3.5 | active | — | — |

## Workarounds

1. **Check network connectivity and ensure pub.dev is accessible. Temporarily disable VPN or firewall, then run 'flutter pub get --offline' if dependencies are already cached, or use a mirror like 'dart pub get --no-precompile' with PUB_HOSTED_URL set to a mirror.** (85% success)
   ```
   Check network connectivity and ensure pub.dev is accessible. Temporarily disable VPN or firewall, then run 'flutter pub get --offline' if dependencies are already cached, or use a mirror like 'dart pub get --no-precompile' with PUB_HOSTED_URL set to a mirror.
   ```
2. **Use a different DNS server (e.g., Google DNS 8.8.8.8) or add an exception for pub.dev in the firewall/proxy settings.** (80% success)
   ```
   Use a different DNS server (e.g., Google DNS 8.8.8.8) or add an exception for pub.dev in the firewall/proxy settings.
   ```

## Dead Ends

- **Repeatedly running 'flutter pub get' without any network changes** — The underlying network issue persists; retrying does not resolve connectivity problems. (95% fail)
- **Deleting the pubspec.lock file and running pub get again** — The lock file is not the cause; the error is network-related, so deletion has no effect. (85% fail)
