Skip to content

[flutter_tools] Add WebContext, Device.createFlutterDevice, and WebDeviceLogReader - #197230

Open
bkonyi wants to merge 7 commits into
flutter:masterfrom
bkonyi:web-runner-2-web-context
Open

bkonyi wants to merge 7 commits into
flutter:masterfrom
bkonyi:web-runner-2-web-context

Conversation

@bkonyi

@bkonyi bkonyi commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Introduces WebContext (with chromiumLauncher, webWorkflow, and optional WebFlutterDeviceBuilder) and wires it through ToolDependencies, FlutterDeviceManager, WebDevices, WebDevice, and DoctorValidatorsProvider.

Adds Device.createFlutterDevice, extracts FlutterDevice.createCompilers and FlutterDevice.createDefault, migrates all FlutterDevice.create callers, and removes FlutterDevice.create.

Adds WebDeviceLogReader streaming Stdout and Stderr VM service events and consolidates log reader and disposal handling onto WebDevice.

Stack:

  1. [flutter_tools] Extract PlatformDebuggingOptions and move WebDebugConfig #197229
  2. [flutter_tools] Add WebContext, Device.createFlutterDevice, and WebDeviceLogReader #197230
  3. [flutter_tools] Add polymorphic FlutterDevice seams to resident runners #197231
  4. [flutter_tools] Add WebFlutterDevice and unit tests #197232
  5. [flutter_tools] Replace ResidentWebRunner with WebFlutterDevice #197233

Introduces `PlatformDebuggingOptions` and `DebuggingOptions.platformOptions` so platform-specific debugging configuration no longer lives in `device.dart`. Moves `WebDebugConfig` into `lib/src/web/web_debug_config.dart`, absorbs `nativeNullAssertions` and `webDefines` into `WebDebugConfig`, and passes `WebDebugConfig` directly to `WebDevFS` and `WebAssetServer.start`.

Removes dead legacy compatibility keys (`webUseLocalCanvaskit`, `dumpSkpOnShaderCompilation`, `cacheSkSL`, `fastStart`) from `DebuggingOptions.toJson()`, drops redundant `webDefines` forwarding parameters across runners and driver services, and preserves `ProxiedDevice` JSON round-trip parsing via `PlatformDebuggingOptionsParser`.
…viceLogReader

Introduces `WebContext` (with `chromiumLauncher`, `webWorkflow`, and optional `WebFlutterDeviceBuilder`) and wires it through `ToolDependencies`, `FlutterDeviceManager`, `WebDevices`, `WebDevice`, and `DoctorValidatorsProvider`.

Adds `Device.createFlutterDevice`, extracts `FlutterDevice.createCompilers` / `FlutterDevice.createDefault`, migrates all `FlutterDevice.create` callers, and removes `FlutterDevice.create`.

Adds `WebDeviceLogReader` streaming `Stdout` and `Stderr` VM service events and consolidates log reader and disposal handling onto `WebDevice`.
@bkonyi bkonyi added the CICD Run CI/CD label Nov 23, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 23, 2026
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-flutter__flutter that referenced this pull request Nov 24, 2026
…fig (flutter#197229)

Introduces `PlatformDebuggingOptions` and
`DebuggingOptions.platformOptions` so platform-specific debugging
configuration no longer lives in `device.dart`. Moves `WebDebugConfig`
into `lib/src/web/web_debug_config.dart`, absorbs `nativeNullAssertions`
and `webDefines` into `WebDebugConfig`, and passes `WebDebugConfig`
directly to `WebDevFS` and `WebAssetServer.start`.

Removes dead legacy compatibility keys (`webUseLocalCanvaskit`,
`dumpSkpOnShaderCompilation`, `cacheSkSL`, `fastStart`) from
`DebuggingOptions.toJson()`, drops redundant `webDefines` forwarding
parameters across runners and driver services, and preserves
`ProxiedDevice` JSON round-trip parsing via
`PlatformDebuggingOptionsParser`.

Stack:
1. flutter#197229
2. flutter#197230
3. flutter#197231
4. flutter#197232
5. flutter#197233
@bkonyi
bkonyi marked this pull request as ready for review November 25, 2026 03:30
@bkonyi
bkonyi requested a review from mdebbar November 25, 2026 03:30

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the Flutter tool's web device architecture by introducing WebContext to manage web-specific dependencies and delegating FlutterDevice creation to Device.createFlutterDevice. It also adds WebDeviceLogReader to stream VM service logs for web devices. Feedback on these changes highlights a potential runtime StateError in attach.dart due to a missing flutterProject argument, suggests refining RPCError handling in WebDeviceLogReader to only ignore stream-already-subscribed errors (code 103), and recommends replacing experimental null-aware collection elements with standard collection if elements for better compatibility.

…context

# Conflicts:
#	packages/flutter_tools/lib/src/commands/attach.dart
#	packages/flutter_tools/lib/src/commands/run.dart
#	packages/flutter_tools/lib/src/resident_runner.dart
#	packages/flutter_tools/test/commands.shard/hermetic/daemon_test.dart
#	packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
#	packages/flutter_tools/test/commands.shard/hermetic/tool_extensions_integration_test.dart
#	packages/flutter_tools/test/general.shard/drive/web_driver_service_test.dart
#	packages/flutter_tools/test/general.shard/resident_runner_test.dart
#	packages/flutter_tools/test/general.shard/web/devices_test.dart
Pass `flutterProject` from `AttachCommand._discoverVmServiceAndCreateResidentRunner` to `device.createFlutterDevice`, rethrow non-`kStreamAlreadySubscribed` `RPCError`s in `WebDeviceLogReader.provideVmService`, document optional subclass parameters on `Device.createFlutterDevice`, and add unit tests in `attach_test.dart` and `devices_test.dart`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant