This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
What is the link to the issue this cherry-pick is addressing?
Example issue: https://github.com/flutter/flutter/issues/81666
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
Improve logging for UTF-8 decoding errors.
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
When an exception is thrown within a transformer provided to `Stream.transform(...)`, an asynchronous stack trace pointing to the internal transformation machinery is reported instead of where the call to `transform(...)` was made, making tracking down where these exceptions come from extremely difficult.
### Workaround:
Is there a workaround for this issue?
No.
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
Not a fix, just additional logging. Tests have been added to ensure this extension works as expected.
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
What is the link to the issue this cherry-pick is addressing?
https://github.com/flutter/flutter/issues/177948
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
Add additional analytics for `flutter widget-preview start`
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Analytics collected for `flutter widget-preview start` won't give an accurate representation of usage as IDE plugins will start launching the widget previewer by default. This will result in `widget-preview` analytics effectively tracking the number of IDE users rather than actual usage of the widget previewer.
### Workaround:
Is there a workaround for this issue?
No
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
N/A
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
What is the link to the issue this cherry-pick is addressing?
https://github.com/flutter/flutter/issues/176462
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
Provides guided error message when building for iOS fails due to precompiled headers cache error.
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
When using Xcode 26 and switching between branches or upgrading to new beta/stable, it throws an error due to headers of the Flutter framework changing.
### Workaround:
Is there a workaround for this issue?
Run `flutter clean`
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
1. git checkout 3.35.5
2. `flutter create my_app`
3. `flutter build ios`
4. git checkout main
5. `flutter build ios` (it should error)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
What is the link to the issue this cherry-pick is addressing?
https://github.com/flutter/flutter/issues/176310
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
`app.dtd` event is not emitted for Flutter web applications run with `--machine`.
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Makes it impossible for tooling to connect to the DTD instance associated with a Flutter web application. This impacts the Flutter MCP extension.
### Workaround:
Is there a workaround for this issue?
No workaround available.
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
Run a web application using `flutter run -d chrome --machine` and verify there's an `app.dtd` event once the application has started.
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
What is the link to the issue this cherry-pick is addressing?
https://github.com/flutter/flutter/issues/176206 / https://github.com/Dart-Code/Dart-Code/issues/5730
This is related to another cherry-pick at https://github.com/flutter/flutter/pull/176976. That cherry-pick adds a warning to `flutter run` and this cherry-pick ensures the warning is forwarded correctly to DAP clients (like VS Code).
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
Warns the developer that wireless debugging may be slow on iOS 26 in VS Code.
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Debugging wirelessly on iOS 26 may be slow. This change forwards the warning (which is being cherry-picked by https://github.com/flutter/flutter/pull/176976) to DAP clients so that it can be shown more prominently in VS Code.
### Workaround:
Is there a workaround for this issue?
This change is to show a workaround for the slow debugging to the user.
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
Testing requires using a DAP client. The automated test verifies the event is forwarded, and I tested manually with the Dart-Code changes when I added this change (screenshots at https://github.com/Dart-Code/Dart-Code/issues/5730#issuecomment-3389479520).
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.
### Issue Link:
https://github.com/flutter/flutter/issues/176206
### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples
Warns the developer that wireless debugging may be slow on iOS 26
### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)
Debugging wirelessly on iOS 26 may be slow. This warning suggests that the developer use a wired connection.
Additionally, this will be surfaced in IDEs: https://github.com/Dart-Code/Dart-Code/issues/5730
### Workaround:
Is there a workaround for this issue?
The tool is proposing the workaround.
### Risk:
What is the risk level of this cherry-pick?
### Test Coverage:
Are you confident that your fix is well-tested by automated tests?
### Validation Steps:
What are the steps to validate that this fix works?
Connect an iPhone running iOS 26 wirelessly, `flutter run`.
**Impacted Users:**
Flutter web developers using the `web-server` device for hot reload/restart.
**Impact Description:**
Hot reload/restart crashes when the browser tab is closed, causing “Bad state: No element” errors and breaking the DWDS connection.
**Workaround:**
Rerun the app.
**Risk:**
Low — changes only affect hot reload/restart handling when no clients are connected.
**Test Coverage:**
Yes — covered by automated integration tests and verified with manual testing across reload/restart scenarios.
**Validation Steps:**
1. run the app on webserver `flutter run -d web-server`
2. open the url
3. do hot reload
4. close the browser
5. do hot reload
You should see a warning `WebSocketProxyService: No clients available.` along with `Recompile complete. No client connected.` printed in the console. The app should no longer crash.
**Merged PR:** https://github.com/flutter/flutter/pull/177026
**Changes in DWDS (Parent PR):** [https://github.com/dart-lang/webdev/pull/2699](https://github.com/dart-lang/webdev/pull/2699)
Fixes https://github.com/flutter/flutter/issues/174791
This change consists of several UI changes:
- Added theming support for light and dark mode based on system
preferences
- Pulled in a subset of the DevTools theming constants
- Reduced size of widget preview buttons and controls
- Added initial support for setting theme based on IDE parameters passed
as query parameters. This does not include responding to theme changes
made after the widget previewer is loaded.
- Fixed issue where the `WidgetPreviewErrorWidget` would still show
controls, even though they aren't relevant
**IDE Theming Example:**
<img width="1149" height="571" alt="image"
src="https://github.com/user-attachments/assets/d84beacd-6b1c-4186-b793-88aae58613c1"
/>
When registering the `WidgetPreviewScaffoldInspectorService`, we were
originally setting it after the bindings were initialized. This meant
that the widget inspector service extensions were registered with the
original `WidgetInspectorService` and were not taking the custom
codepaths in the override.
This change moves the `WidgetPreviewScaffoldInspectorService`
initialization to before the bindings are initialized.
Also moves `dtd_services_test.dart` to actually use the
`WidgetPreviewScaffoldDtdServices` implementation, which would have
caught the typecast issue in the implementation.
Projects within the same workspace can depend on each other without
explicitly specifying path dependencies or dependency overrides using
the following syntax:
```
dependencies:
my_workspace_project: # No constraint or path
```
This is treated as a "hosted" dependency, which conflicts with the path
dependencies used by the widget_preview_scaffold.
This change introduces dependency_overrides for each package in the
workspace watched by the widget previewer to allow for dependencies to
be resolved correctly.
Fixes https://github.com/flutter/flutter/issues/176018
This change introduces `PersistentPreferences`, which allows for the
widget previewer to save settings to disk.
`PersistentPreferences` makes use of the existing `~/.flutter-devtools`
directory used by DevTools for the same purpose, writing preferences in
JSON format to `~/.flutter-devtools/.widget-preview`.
When running `flutter pub get` from the root of a Pub workspace,
localizations are generated for each subproject. However, we were trying
to write the untranslated messages file relative to the current
directory, not the target project's directory.
This change updates the logic for determining the output location of the
untranslated messages file to include the target project root.
Fixes https://github.com/flutter/flutter/issues/174205
With the assumption that IDEs will not create a debug session for the
widget previewer, the widget inspector's source navigation functionality
won't function as there's no IDE to listen to `navigate` events sent via
`postEvent`.
This change overrides some widget inspector behavior to allow for
navigating to source locations via the DTD Editor service instead of
relying on the VM service's `postEvent`.
This change also makes some minor changes to the diagnostic properties
and descriptions displayed within the inspector to display group and
custom preview annotation details.
Towards https://github.com/flutter/flutter/issues/166423
Related to #176027
Minimum agp version already requires Java 17 this aligns our tooling.
This pr needs to land after the following prs
1. https://github.com/flutter/flutter/pull/176203
2. https://github.com/flutter/flutter/pull/176204
3. https://github.com/flutter/flutter/pull/176097
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Related to #176027
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
This change adds support for two DTD Editor service RPCs and makes
functionality that's dependent on the availability of the Editor service
reactive to the service availability changing.
The newly added `getActiveLocation` Editor RPC now allows for us to
properly determine which source file is selected at startup, removing
the need for special casing around initializing the filtered preview
set.
The `navigateToCode` Editor RPC is now supported, and URIs in stack
traces can now be clicked to navigate to the source location in the IDE.
Both filtering previews by selected file and stack frame navigation
links are only enabled when the Editor service is available.
Fixes https://github.com/flutter/flutter/issues/176113
Related to #176027
Needs to land after https://github.com/flutter/flutter/pull/176094
- **Add java warn and error to android workflow**
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This pr assumes https://github.com/flutter/flutter/pull/176049 lands
first.
- **Update java version ranges with the top end limitation for java pre
17**
- **change default for unknown agp version to true for java support**
- **Add kotlin 2.2* support for analyze --suggestions**
-
Related to https://github.com/flutter/flutter/issues/175669 and
https://github.com/flutter/flutter/issues/176027
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Update the maxKnownAndSupported versions of Java (now 26), AGP (from
8.9.1 to 8.13), and Gradle (now 9.1).
Add tests for new codepaths and expand existing test coverage. Some
typos and changes to aid debugging included as well.
AGP 9 was made available for preview last week
https://developer.android.com/build/releases/agp-preview.
Fixes: https://github.com/flutter/flutter/issues/175669
Commits:
- **update max known and supported java, gradle and agp**
- **make tests in a loop and add testing for get java version for and
validate java and agp**
- **move some tests to gradle_utils, make debugging easier**
- **Migrated gradle_utils tests from gradle_test to gradle_utils_test**
---------
Co-authored-by: Camille Simon <43054281+camsim99@users.noreply.github.com>
Windows file URIs reported by IDEs can be percent encoded. This change
decodes all URIs for `TextDocument` instances to ensure they're
consistent with the URIs provided by the tool.
Fixes https://github.com/flutter/flutter/issues/175524
Gradle 9.1.0 was released on 2025-09-18.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
This change updates `Preview` to be a `base` class instead of `final`,
allowing for developers to extend `Preview` and create their own custom
preview annotations.
To reduce friction associated with working with `const` constructors,
two new methods have been added: `MultiPreview.transform()` and
`Preview.transform()`. These methods are invoked at runtime by the
preview environment, allowing for developers to create or modify
`Preview` instances with non-constant values. This also relaxes
restrictions around `Preview`'s callback parameters (e.g., `wrapper`),
which do not need to be static or public when provided to a `Preview` in
the context of a `*.transform()` method. This makes it possible to
create custom preview classes that completely encapsulate their
callbacks, removing the need for separate public, static function
declarations.
To make transforming `Preview`s simpler, a `PreviewBuilder` utility
class has also been added.
Fixes https://github.com/flutter/flutter/issues/175534
It's possible for the DTD `Editor` service to send a
`ActiveLocationChanged` event with a null `textDocument` when a
'synthetic' file is selected (e.g., IDE settings, the widget previewer,
etc.). The previewer should not react to these events and should
continue rendering the last set of filtered previews from a valid source
file.
This PR contains the initial work to prepare for the removal of
instances of DevTools being served manually by the flutter_tool, instead
relying on DDS to serve DevTools. This will be consistent with how the
standalone Dart VM serves DevTools, tying the DevTools lifecycle to a
live DDS instance. This will allow for the removal of much of the logic
needed to properly manage the lifecycle of the DevTools server in a
future PR. Also, by serving DevTools from DDS, users will no longer need
to forward a secondary port in remote workflows as DevTools will be
available on the DDS port.
There's two remaining circumstances that will prevent us from removing
`DevtoolsRunner` completely:
- The daemon's `devtools.serve` endpoint
- `flutter drive`'s `--profile-memory` flag used for recording memory
profiles
This change:
- Hides `v` from the help menu on web in profile/release mode
- Keeps `v` available in debug and on native platforms
- Change command order: `v` now appears before `s` in help
- Updates `_commonTerminalInputHandler` to block `v` on web in release
mode
Testing:
- Added new test: `printHelpDetails hides v on web in profile mode`
- Added new test: 'v - does not launchDevToolsInBrowser on web in
profile mode'
- Fixed existing test to match correct command order (`v` before `s`)
fixes#143451
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Daniil Lipatkin <nt4f04uNd@gmail.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
This change adds the following events:
- `widget_preview.initializing`: sent immediately after the widget
previewer starts. This event includes the PID of the process starting
the widget previewer for use by tooling to explicitly kill the tool
process.
- `widget_preview.logMessage`: sent for calls to `Logger` methods when
in machine mode. This follows the same format as `daemon.logMessage`.
This change also fixes and improves testing of
`WidgetPreviewMachineAwareLogger` in `widget_preview_machine_test.dart`
as the existing test validator did not cause tests to fail correctly.
Fixes https://github.com/flutter/flutter/issues/175002
This change adds support for creating groups of widget previews.
Previews with the same `group` parameter will be grouped together in a
collapsable tile in widget previewer. Previews without a provided
`group` will be placed in the `Default` group.
This change also slightly reworks the UI to make individual previews
more easily distinguishable from preview groups, moves the controls for
the previewer to the bottom of the preview window, and adds a divider
between the preview name and preview content if a name is provided.
Fixes https://github.com/flutter/flutter/issues/173871
**Example:**
<img width="767" height="640" alt="image"
src="https://github.com/user-attachments/assets/80dc202c-77d3-42a5-be9d-e0d9a9a0f28b"
/>
This change allows for the widget previewer to react to
`activeLocationChanged` events sent over the `Editor` DTD service to
automatically filter the set of visible previews based on the currently
selected file in the IDE. This functionality can be turned on or off
depending on whether or not the developer wants to see all previews in
the project at once.
This change also includes some minor refactoring and UI changes to move
the widget preview environment controls to a reserved area at the bottom
of the preview window.
**Demo:**
https://github.com/user-attachments/assets/c3b93826-8437-4655-8264-6beed6651fe7
This PR retries the previously reverted PR #169293.
> [!NOTE]
> This feature was originally intended to be Impeller-only, and it was
agreed that no additional engine changes were necessary. However, during
testing on the Metal backend, a shader loading issue occurred. In my
view, this seems to be a simple problem caused by the shader not being
included in the engine’s runtime_stages.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Kate Lovett <katelovett@google.com>