Repository navigation
Description
The flag is accepted and used to reject incompatible combinations, but never reaches pub, so the command resolves over the network.
In packages/flutter_tools/lib/src/commands/update_packages.dart at 3.47.5, offline is read once and used only in two guards:
final bool offline = boolArg(_keyOffline); // :139
if (forceUpgrade && offline) { throwToolExit(...) } // :151
if (cherryPicks.isNotEmpty && offline) { ... } // :159Both pub invocations in that file omit it:
Future<void> _pubGet(FlutterProject project, bool enforceLockfile) async =>
pub.get(context: PubContext.pubGet, project: project,
enforceLockfile: enforceLockfile); // :241
await pub.interactively(<String>['upgrade', '--tighten', '-C', projectTempDir.path],
context: PubContext.updatePackages, ...); // :293Pub.get has the parameter and forwards it (lib/src/dart/pub.dart:151, and if (offline) '--offline' at :342); other callers such as create.dart and widget_preview.dart do pass it.
Observed with the network unreachable, a pub cache holding every package the lockfile names, and PUB_HOSTED_URL left at its default:
$ flutter update-packages --offline
Resolving dependencies...
Downloading packages...
ClientException with SocketException: Connection failed
(OS Error: Network is unreachable, errno = 101), address = pub.dev, port = 443,
uri=https://pub.dev/api/packages/archive/advisories
Failed to update packages.
pub's own advisories fetch is offline-guarded (_fetchAdvisories, third_party/pkg/pub/lib/src/source/hosted.dart:566, "Don't attempt to fetch advisories in --offline mode"), which is consistent with pub simply never being told it is offline here.
Two further observations from the same environment, for whoever picks this up:
- With
--offlinereaching pub, the command still does not complete: it re-resolves rather than honoring the lockfile, and had not finished after 15 minutes.dart pub get --offlineagainst the same cache returns in under a second. flutter doctorsimilarly runsdart pub ... getfor packages/flutter_tools without--offline; with no network that step fails and doctor still exits 0.
Context: packaging the SDK for Yocto, where builds run with the network off by policy.
Activity
puneetkukreja98 commentedon Sep 28, 2026
@jwinarske Thanks for reporting this, routing this to team-tool for further investigation.
[flutter_tools] forward --offline flag to pub.get in update-packages (f…
Revert: [flutter_tools] forward --offline flag to pub.get in update-p…
flutter-triage-bot commentedon Oct 19, 2026
The
triaged-toollabel is irrelevant if there is noteam-toollabel orfyi-toollabel.Reland "[flutter_tools] forward --offline flag to pub.get in update-p…
[flutter_tools] forward --offline flag to pub.get in update-packages (f…
Revert: [flutter_tools] forward --offline flag to pub.get in update-p…
Reland "[flutter_tools] forward --offline flag to pub.get in update-p…
github-actions commentedon Nov 6, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.