Repository navigation
[flutter_tools] Remove service and runner ambient context getters - #196571
Merged
auto-submit[bot] merged 3 commits intoNov 17, 2026
Merged
Conversation
Removes the remaining 9 service and runner ambient `context.get<T>()` getters from `packages/flutter_tools/lib/`: - `pub` (`lib/src/dart/pub.dart`) - `AssetBundleFactory.instance` (`lib/src/asset.dart`) - `templatePathProvider` (`lib/src/template.dart`) - `DevtoolsLauncher.instance` (`lib/src/resident_runner.dart`) - `MDnsVmServiceDiscovery.instance` (`lib/src/mdns_discovery.dart`) - `ApplicationPackageFactory.instance` (`lib/src/application_package.dart`) - `androidBuilder` (`lib/src/android/android_builder.dart`) - `hookRunner` (`lib/src/hook_runner.dart`) - `webRunnerFactory` (`lib/src/web/web_runner.dart`) Wires these dependencies explicitly through `ToolDependencies`, `FlutterCommandRunner`, `FlutterCommand`, commands, device discoverers, and resident/test runners, while preserving `resolveOverride` bridging in `lib/runner.dart`. Part of flutter#47161
Updates `FakeToolDependencies` in `test/src/fakes.dart` and removes the stale duplicate in `args_test.dart`, passes `LocalPlatform` in `asset_bundle_package_test.dart` to match `testFileSystem` style on Windows, and uses `getFlutterRoot()` for `TemplatePathProvider` in `build_swift_package_test.dart`.
bkonyi
marked this pull request as ready for review
November 16, 2026 22:00
bkonyi
requested review from
chingjun and
okorohelijah
and removed request for
a team
November 16, 2026 22:00
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the dependency injection mechanism in flutter_tools by removing global context lookups (such as context.get) and replacing them with explicit constructor-based dependency injection. Key dependencies, including AndroidBuilder, ApplicationPackageFactory, AssetBundleFactory, DevtoolsLauncher, Pub, TemplatePathProvider, WebRunnerFactory, and MDnsVmServiceDiscovery, are now bootstrapped in ToolDependencies and passed explicitly to commands, runners, and devices. Corresponding unit and integration tests have been updated to supply these dependencies directly. I have no feedback to provide as there are no review comments.
chingjun
approved these changes
Nov 17, 2026
auto-submit Bot
pushed a commit
to flutter/packages
that referenced
this pull request
Nov 17, 2026
flutter/flutter@d8bd864...2f09f96 2026-11-17 [email protected] Analyze every flutter create template, and fix the package_ffi lint (flutter/flutter#196165) 2026-11-17 [email protected] Roll Dart SDK from 50debf3c9757 to 26e38955d9d4 (3 revisions) (flutter/flutter#196772) 2026-11-17 [email protected] Manual roll ICU from b09986242cfb to d3c612f44146 (1 revision) (flutter/flutter#196713) 2026-11-17 [email protected] Roll Skia from 4f6b3a8d8565 to 503a380ebecc (19 revisions) (flutter/flutter#196768) 2026-11-17 [email protected] iOS: Don't mock UIView animations in keyboard spring animation test (flutter/flutter#196755) 2026-11-17 [email protected] [flutter_tools] Preserve index.html across --web-content-hash transitions (flutter/flutter#196491) 2026-11-17 [email protected] Fix TextStyle background color fade-out when lerping to null (flutter/flutter#196153) 2026-11-17 [email protected] Update desktop engine TESTOWNERS (flutter/flutter#196732) 2026-11-17 [email protected] [flutter_tools] Do not copy app-only build type properties onto library plugins (flutter/flutter#196692) 2026-11-17 [email protected] [flutter_tools] Remove service and runner ambient context getters (flutter/flutter#196571) 2026-11-17 [email protected] Bump customer tests (flutter/flutter#196740) 2026-11-17 [email protected] Take customer_testing_flame out of bringup (flutter/flutter#196570) 2026-11-17 [email protected] [devicelab] Read AssetManifest.bin from the APK in flavors_test (flutter/flutter#196736) 2026-11-17 [email protected] [flutter_tools] Fix flaky tool_tests_general by moving spawnUri tests to integration shard (flutter/flutter#195999) 2026-11-17 [email protected] Roll Dart SDK from 3e069c6fdbde to 50debf3c9757 (2 revisions) (flutter/flutter#196706) 2026-11-16 [email protected] [web] Record build finish synchronously in renderScene and fix dropped frame timings (flutter/flutter#195947) 2026-11-16 [email protected] Do not reveal obscured character when input is rejected by inputFormatters (flutter/flutter#195022) 2026-11-16 [email protected] Cla draft follow up: add waiting for response (flutter/flutter#196686) 2026-11-16 [email protected] Roll pub packages (flutter/flutter#196684) 2026-11-16 [email protected] Roll Packages from 015df97 to 4c6a7d3 (8 revisions) (flutter/flutter#196681) 2026-11-16 [email protected] Skip Vulkan impeller_unittests on macOS (flutter/flutter#196282) 2026-11-16 [email protected] Move the task runners out of Flutter Engine (flutter/flutter#196267) 2026-11-16 [email protected] [FGP] Add Flutter assets after AGP's asset merge so dotfiles are pack… (flutter/flutter#196465) 2026-11-16 [email protected] iOS: Add Obj-C model for platform view composition params (flutter/flutter#196498) 2026-11-16 [email protected] [Windows] Normalize Shift key messages with a non-standard scan code (flutter/flutter#193675) 2026-11-16 [email protected] Roll Skia from 118eaff3deb4 to 4f6b3a8d8565 (3 revisions) (flutter/flutter#196672) 2026-11-16 [email protected] Roll Dart SDK from c91e8b6674e2 to 3e069c6fdbde (4 revisions) (flutter/flutter#196669) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
bkonyi
added a commit
to bkonyi/flutter
that referenced
this pull request
Nov 18, 2026
Resolves merge conflicts with flutter#196571 by keeping both `hook_runner.dart` and `project.dart` imports in `drive_service.dart` and passing `assetBundleFactory`, `devtoolsLauncher`, and `applicationPackages` directly to `DriveCommand` in `drive_test.dart`. Fixes flutter#134073
bkonyi
added a commit
to bkonyi/flutter
that referenced
this pull request
Nov 18, 2026
Resolves merge conflicts with flutter#196571, picks up flutter#196572 and flutter#196740, and converts the remaining prebuilt-binary filter test in `drive_test.dart` to `testWithoutContext`. Fixes flutter#134073
famio
added a commit
to famio/flutter
that referenced
this pull request
Nov 21, 2026
BuildableIOSApp now requires it after flutter#196571.
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the 9 service and runner ambient
context.get<T>()getters (pub,AssetBundleFactory.instance,templatePathProvider,DevtoolsLauncher.instance,MDnsVmServiceDiscovery.instance,ApplicationPackageFactory.instance,androidBuilder,hookRunner, andwebRunnerFactory) frompackages/flutter_tools/lib/and wires them explicitly throughToolDependencies,FlutterCommandRunner,FlutterCommand, commands, device discoverers, and resident/test runners.Part of #47161
Pre-launch Checklist
///).