9947 Commits

Author SHA1 Message Date
Moritz
5b94ea2326 Data assets
Refiling of #169273, which itself is a rebase of #159675

This PR adds bundling support for the experimental dart data asset
feature: Dart packages with hooks can now emit data assets which the
flutter tool will bundle.

It relies on flutter's existing asset bundling mechanism (e.g. entries
in AssetManifest.json, DevFS syncing in reload/restart, ...).

The support is added under an experimental flag (similar to the existing
native assets experimental flag).

Also, kNativeAssets is removed to also bundle data assets on flutter
build bundle.

The chrome sandbox is disabled as per #165664.

- [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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-14 16:32:25 +02:00
Loïc Sharma
5154d16d1f
[tool] Make google3 have to override feature flags (#171933)
_⚠️ Landing this is blocked until: 1)
https://critique.corp.google.com/cl/781275353 lands and 2) google3 is
updated to add the new feature flag introduced in
https://github.com/flutter/flutter/pull/171903._

Currently, google3's `Google3Features` extends `FeatureFlags`. As a
result, google3 automatically gets the same feature flag values as in
Flutter.

This makes Flutter's feature flag values abstract, thereby requiring
that google3's `Google3Features` must explicitly set each feature flag's
value.

Discussion that motivated this change:
https://github.com/flutter/flutter/pull/171797
Internal CL: https://critique.corp.google.com/cl/781275353
Part of: https://github.com/flutter/flutter/issues/167668

## 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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-11 20:42:08 +00:00
Ben Konyi
1709c884aa
[ Tool ] Enable omit_obvious_*_types and specify_nonobvious_*_types lints (#172018)
Sources under `packages/flutter_tools/` aren't accessible to the average
Flutter user by navigating through sources from their projects, so it
doesn't need to be as explicitly verbose with types for readability
purposes. The `always_specify_types` lint results in extremely verbose
code within the tool which adds little value.

This change disables `always_specify_types` in favor of a new set of
lints that aim to reduce verbosity by removing obvious types while also
maintaining readability in cases where variable types otherwise wouldn't
be obvious:

  - `omit_obvious_local_variable_types`
  - `omit_obvious_property_types`
  - `specify_nonobvious_local_variable_types`
  - `specify_nonobvious_property_types`
2025-07-11 19:32:57 +00:00
Mouad Debbar
255e8c20a0
Run hot_reload_with_asset_web_test.dart on Mac/Windows (#171280)
Part of https://github.com/flutter/flutter/issues/171276
2025-07-11 15:09:07 +00:00
Mouad Debbar
cbe78368ee
Run stateless_stateful_hot_reload_web_test.dart on Mac/Windows (#171283)
Part of https://github.com/flutter/flutter/issues/171276
2025-07-10 15:38:33 +00:00
Matan Lurey
89ed67d7b0
Add flutter config --enable-omit-legacy-version-file (#171903)
Towards https://github.com/flutter/flutter/issues/171900.

We can decide how quickly to move here, but a feature flag will make it
easier to try out/rollback.
2025-07-09 21:30:01 +00:00
Danny Valente
953b6e4a28
Allow flutter attach to discover flutter engine running on Custom Device (#170635)
## Summary

A Custom Device's log reader doesn't do anything, and thus `flutter
attach` will fail to ever find the flutter engine's VM service.

This change adds a new `readLogs` command to the CustomDeviceConfig, and
which allows a custom device to read the logs from the running flutter
app on the actual custom device, and then allow flutter attach to work.

Fixes #170634

## Testing

Created a custom device, and added the following readLogs command in the
`custom_devices.json` file:
```
"readLogs": [
        "sshpass",
        "-f",
        "/home/dvalente/player.txt",
        "ssh",
        "root@10.0.0.20",
        "tail -Fn +1 /opt/log/flutter.log"
      ]
```

Then, running `flutter attach` works every time.

**Tested the following scenarios:**
* Launched `flutter attach` before app is running on device, and once
app runs, flutter attach succeeds
* Launched `flutter attach` after app is already running on device, and
flutter attach succeeds.
* Used `flutter attach` in Android Studio, and hot reload works just
like any Android device.
2025-07-09 21:28:49 +00:00
Matan Lurey
4abe4d35f5
Hide the rarely direct used --sample argument by default (#171898)
Closes https://github.com/flutter/flutter/issues/51859.
2025-07-09 21:28:49 +00:00
Matan Lurey
f13c1d0dad
Support NO_COLOR to opt-out of flutter tool ANSI colors (#171892)
Closes https://github.com/flutter/flutter/issues/49444.
2025-07-09 21:28:49 +00:00
Nate Biggs
06ce4bb187
Add analytics events for wasm dry runs on web builds (#171818)
Follow up to https://github.com/flutter/flutter/pull/171682
Depends on https://github.com/dart-lang/tools/pull/2125

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
2025-07-09 21:25:52 +00:00
Matan Lurey
e212d3dcd8
Add total execution time to the flutter upgrade command (#171475)
Closes https://github.com/flutter/flutter/issues/47090.
2025-07-09 21:23:49 +00:00
Reid Baker
0843e6f693
[Documentation] When updating kgp minimum document additional changes that are required (#171819)
## 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.
2025-07-08 22:08:05 +00:00
Nate Biggs
b5b3636106
Add support for running dart2wasm in dry run mode on js compilations (#171682)
Example message with findings:

```

Wasm dry run findings:
Found incompatibilities with WebAssembly.

package:counter1/main.dart 3:1 - dart:html unsupported (0)


Consider addressing these issues to enable wasm builds. See docs for more info: https://docs.flutter.dev/platform-integration/web/wasm


Compiling lib/main.dart for the Web...                             10.9s
✓ Built build/web
```

Example message without findings:

```

Wasm dry run succeeded. Consider building and testing your application with the `--wasm` flag. See docs for more info: https://docs.flutter.dev/platform-integration/web/wasm

Compiling lib/main.dart for the Web...                             10.8s
✓ Built build/web
```

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
2025-07-08 21:39:50 +00:00
Matan Lurey
968b657788
Remove now duplicate un-forward ports for Android (#171473)
Closes https://github.com/flutter/flutter/issues/46114.

Cleans up the `attach_test` suite a bit to be more reflective of the
real code.
2025-07-08 21:00:01 +00:00
Reid Baker
7762b4cf32
Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (#171776)
- **Relands "Bump warn and error versions of agp, kotlin and gradle
versions in preparation for gradle 9 (#171399)"**
- **bump lockfile generator to use kotlin 2.1.0**
- **Update formatting of lockfile to pass ktlint** 

Updated lockfiles with
`JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home/
dart dev/tools/bin/generate_gradle_lockfiles.dart` after
dev/tools/bin/generate_gradle_lockfiles.dart to bump the versions of
kotlin.

Failing tests from first attempt
https://flutter-dashboard.appspot.com/#/build?hashFilter=84a5ce765d193a9c79ab4297f367d5ad7efc5dac&showMac=false&showWindows=false&showiOS=false&showLinux=false&showBringup=true&repo=flutter&branch=master

Verified example test that cause revert was passing by running the
following

- `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t
run_debug_test_android.dart` from `dev/devicelab`
- `../../bin/cache/dart-sdk/bin/dart bin/test_runner.dart test -t
run_release_test` from `dev/devicelab`
- `SHARD=android_engine_vulkan_tests bin/cache/dart-sdk/bin/dart
dev/bots/test.dart` from root with an android emulator. Hard to actually
verify because the emulator is closed as part of the tests but no
failures were from failures to compile.
- `flutter test
test/general.shard/android/android_project_migration_test.dart` from
`packages/flutter_tools/`

## 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.
2025-07-08 18:40:35 +00:00
Matan Lurey
8449573549
Add/use addMachineOutputFlag/outputsMachineFormat instead of strings (#171459)
Prepares to make changes such as
https://github.com/flutter/flutter/issues/10621 easier.
2025-07-08 18:25:22 +00:00
Ben Konyi
922e00ac3d
[ Tool ] Support upgrading to a new Flutter version pointing to the same revision as a previous version (#171783)
In the case of a bad release, we should be able to release a new version
of Flutter that points to the revision of the last good release.

This change updates the tool to not only compare framework revisions
when determining if the current installation is up to date, and also
updates the tag selection logic to pick the most recent version tag
first.

Fixes https://github.com/flutter/flutter/issues/170679
2025-07-08 17:32:15 +00:00
Mouad Debbar
17e63958f2
Run hot_restart_web_amd_test.dart on Mac/Windows (#171281)
Part of https://github.com/flutter/flutter/issues/171276
2025-07-08 16:09:18 +00:00
John "codefu" McDole
13d2219efd
feat: Use engine_stamp.json in flutter tool (#171454)
The flutter tool will now download and use an `engine_stamp.json` file
to determine the engine version, content hash, build date, and commit
date.

The file is treated as a new `DevelopmentArtifact.informative` and is
fetched before flutterVersion is used. This ensures we have build
information for a clean checkout with no bin/cache folder. Users that
download from flutter.dev will have engine_stamp.json, so its a no-op.

This change provides support for content hashed engine artifacts, who's
revision (the hash) is not a git commit sha. A side benefit is "git" is
only used at build time to extract this information.

> [!NOTE]
> Content hashed artifacts are not enabled yet for downloads;
bin/internal/engine.version (releases) and the shell updaters still look
for the git commit sha. One can test this out by setting
`FLUTTER_PREBUILD_ENGINE_VERSION` to the content hash.
2025-07-08 00:16:42 +00:00
Ben Konyi
a5541161e8
[ Tool ] Remove long-deprecated make-host-app-editable (#171715)
Fixes https://github.com/flutter/flutter/issues/59220
2025-07-08 00:09:26 +00:00
auto-submit[bot]
9b0f94aef6
Reverts "Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (#171399)" (#171736)
<!-- start_original_pr_link -->
Reverts: flutter/flutter#171399
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: matanlurey
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: Many Gradle/Android related tasks are failing
([one
example](https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_mokey%20run_release_test/1347/overview))
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: reidbaker
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {gmackall}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
https://gradle.org/whats-new/gradle-9/ is coming and with it includes
some deprecated methods. Some like
https://github.com/flutter/flutter/pull/171397 can be fixed by
annotations and calling new methods. Some like the deprecation of
minsdkversion on Variant require bumping the minimum versions to be able
to compile code that will work.

b/368604254

## 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.


<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
2025-07-07 23:22:47 +00:00
Reid Baker
84a5ce765d
Bump warn and error versions of agp, kotlin and gradle versions in preparation for gradle 9 (#171399)
https://gradle.org/whats-new/gradle-9/ is coming and with it includes
some deprecated methods. Some like
https://github.com/flutter/flutter/pull/171397 can be fixed by
annotations and calling new methods. Some like the deprecation of
minsdkversion on Variant require bumping the minimum versions to be able
to compile code that will work.

b/368604254

## 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.
2025-07-07 22:11:15 +00:00
Ben Konyi
9de6f68267
[ Tool ] Fix crash when SIGQUIT is sent to enable the VM service for flutter analyze --watch (#171713)
The command was parsing stdout assuming all contents were JSON.

Fixes https://github.com/flutter/flutter/issues/58391
2025-07-07 20:41:26 +00:00
Mouad Debbar
9ed8f90761
Run hot_reload_web_test.dart on Mac/Windows (#171279)
Part of https://github.com/flutter/flutter/issues/171276
2025-07-07 20:03:55 +00:00
Ben Konyi
f64e35af94
[ Tool ] Prepare for enabling omit_obvious_*_types and specify_nonobvious_*_types (#171651)
Applying the specified lints will cause some minor breakages that can be
resolved before the lints are enforced.
2025-07-07 20:02:09 +00:00
Srujan Gaddam
28a4e852bc
Use dwds 24.4.0 (#171669)
Requires a modification to how we compute the hotReloadSourcesUri
contents.

## 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.
- [x] 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.
2025-07-07 20:00:08 +00:00
Mouad Debbar
a9a2d74ac5
[web] Wasm minification default matches JS minification default (#171710)
The default minification behavior should be based on build mode.

Fixes https://github.com/flutter/flutter/issues/171702
2025-07-07 19:58:24 +00:00
Kate Lovett
a04fb324be
Bump Dart to 3.8 and reformat (#171703)
Bumps the Dart version to 3.8 across the repo (excluding
engine/src/flutter/third_party) and applies formatting updates from Dart
3.8.

## 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 `///`).
- [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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-07 17:58:32 +00:00
Ben Konyi
3becc31be8
[ Widget Previews ] Add analytics for flutter widget-preview start (#171641)
Tracks the following metrics:

- Overall launch time with/without generating the widget preview
scaffold
- Time from detecting a file change within the tracked project to
actually loading the updated previews into the previewer

Fixes https://github.com/flutter/flutter/issues/166418
2025-07-04 20:38:26 +00:00
Ben Konyi
bcab634d60
[ Widget Preview ] Add a "Restart Widget Previewer" button to the widget preview scaffold (#171602)
This allows for developers to perform a hot restart on the preview
environment in the case they get into a bad state.

This change adds a `hotRestartPreviewer` method to the `widget-preview`
DTD service registered by the Flutter Tool, which is invoked by the
previewer.


![image](https://github.com/user-attachments/assets/477ce947-76a5-4e78-9769-0ee7f23f2ba6)
2025-07-04 17:57:24 +00:00
Ben Konyi
750b87f551
[ Widget Previews ] Add support for Pub Workspaces (#171538)
Updates the widget previewer to properly handle previews defined across
a workspace. This is effectively equivalent to displaying previews from
multiple individual projects, which required a fairly significant rework
to properly support:

 - resolving asset paths to the right project
 - loading assets across projects in the workspace
 - tracking changes to pubspec.yaml files across the workspace

While making this change, it became apparent that we don't need to
explicitly list the assets from the various projects explicitly in the
scaffold's pubspec.yaml as they're automatically pulled in by adding
those project's as dependencies and using the `package/$ASSET_PATH`
format to load the assets from the scaffold. This allowed for the
removal of a significant amount of logic related to building the
scaffold's pubspec.

Fixes https://github.com/flutter/flutter/issues/169268
2025-07-03 18:09:23 +00:00
Derek Xu
d0d68fc0c8
Add --profile-microtasks flag to flutter run (#170877)
This PR adds a `--profile-microtasks` flag to `flutter run` that can be
used to set [the Flutter Engine's `--profile-microtasks`
switch](https://github.com/flutter/flutter/pull/170690).
2025-07-03 17:16:57 +00:00
Loïc Sharma
19ff5c9419
[Tool] Add all enabled features property (#171547)
https://github.com/flutter/flutter/pull/168437 was reverted as it broke
google3. This adds a `FeatureFlags.allEnabledFeatures` property to the
Flutter tool, which google3 will override to inject its custom feature
flag logic.

[Example google3
failure](https://inspector.corp.google.com/testview;invocationId=0097882f-0362-4cd4-8e82-5e00043b9027;targetId=%2F%2Fmobile%2Fflutter%2Ftests%2Fapp:outside_lib_hot_reload_attach_ios_test_IPHONE_11_15_5;configurationId=8f5d940a576e21051acb7c86f3e612ecc6fed1fab8f179d5a1df840fb4dd05bb;actionId=test_shard0_run0_attempt0;testCase=%23can%20hot%20reload%20the%20app).

## 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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-02 22:52:42 +00:00
auto-submit[bot]
c2cd71309f
Reverts "Add feature flags to the framework (#168437)" (#171542)
<!-- start_original_pr_link -->
Reverts: flutter/flutter#168437
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: chingjun
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: broke internal customers
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: loic-sharma
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {bkonyi, justinmc, matanlurey}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
## Motivation

We'd like to let users opt-in to experimental features so that they can
give early feedback while we iterate on the feature. For example:

Example feature flags:

1. Android sensitive content:
https://github.com/flutter/flutter/pull/158473. When enabled, Flutter
will tell Android when the view contains sensitive content like a
password.
2. Desktop multi-window. When enabled, Flutter will use child windows to
allow things like a context menu to "escape" outside of the current
window.

### Use case

Users will be able to turn on features by:

* **Option 1**: Run `flutter config --enable-my-feature`. This enables
the feature for all projects on the machine
* **Option 2**: Add `enable-my-feature: true` in their `pubspec.yaml`,
under the `flutter` section. This would enable the for a single project
on the machine.

Turning on a feature affects _both_ development-time (`flutter run`) and
deployment-time (`flutter build x`). For example, I can `flutter build
windows` to create an `.exe` with multi-window features enabled.

## How this works

This adds a new
[`runtimeId`](https://github.com/flutter/flutter/pull/168437/files#diff-0ded384225f19a4c34d43c7c11f7cb084ff3db947cfa82d8d52fc94c112bb2a7R243-R247)
property to the tool's `Feature` class. If a feature is on and has a
`runtimeId`, its `runtimeId` will be [stamped into the Dart application
as a Dart
define](https://github.com/flutter/flutter/pull/168437/files#diff-bd662448bdc2e6f50e47cd3b20b22b41a828561bce65cb4d54ea4f5011cc604eR293-R327).
The framework uses this Dart define to [determine which features are
enabled](https://github.com/flutter/flutter/pull/168437/files#diff-c8dbd5cd3103bc5be53c4ac5be8bdb9bf73e10cd5d8e4ac34e737fd1f8602d45).

### Multi-window example

https://github.com/flutter/flutter/pull/168697 shows how this new
feature flag system can be used to add a multi-window feature flag:

1. It adds a new [multi-window
feature](https://github.com/flutter/flutter/pull/168697/files#diff-0ded384225f19a4c34d43c7c11f7cb084ff3db947cfa82d8d52fc94c112bb2a7R189-R198)
to the Flutter tool. This can be turned on using `flutter config
--enable-multi-window` or by putting `enable-multi-window: true` in an
app's .pubspec, under the `flutter` section.
2. It adds a new
[`isMultiWindowEnabled`](https://github.com/flutter/flutter/pull/168697/files#diff-c8dbd5cd3103bc5be53c4ac5be8bdb9bf73e10cd5d8e4ac34e737fd1f8602d45R7-R11)
property to the framework.
3. The Material library can use this new property to determine whether
it should create a new window.
[Example](https://github.com/flutter/flutter/pull/168697/files#diff-2cbc1634ed6b61d61dfa090e7bfbbb7c60b74c8abc3a28df6f79eee691fd1b73).

## Limitations

### Tool and framework only

For now, these feature flags are available only to the Flutter tool and
Flutter framework. The flags are not automatically available to the
embedder or the engine.

For example, embedders need to configure their surfaces differently if
Impeller is enabled. This configuration must happen before the Dart
isolate is launched. As a result, the framework's feature flags is not a
viable solution for this scenario for now. For these kinds of scenarios,
we should continue to use platform-specific configuration like the
`AndroidManifest.xml` or `Info.plist` files.

This is a fixable limitation, we just need to invest in this plumbing :)

### Tree shaking

Feature flags are not designed to help tree shaking. For example, you
cannot conditionally import Dart code depending on the enabled feature
flags. Code that is feature flagged off will still be imported into
user's apps.

## 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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
2025-07-02 20:31:18 +00:00
Loïc Sharma
c6f9e801b2
Add feature flags to the framework (#168437)
## Motivation

We'd like to let users opt-in to experimental features so that they can
give early feedback while we iterate on the feature. For example:

Example feature flags:

1. Android sensitive content:
https://github.com/flutter/flutter/pull/158473. When enabled, Flutter
will tell Android when the view contains sensitive content like a
password.
2. Desktop multi-window. When enabled, Flutter will use child windows to
allow things like a context menu to "escape" outside of the current
window.

### Use case

Users will be able to turn on features by:

* **Option 1**: Run `flutter config --enable-my-feature`. This enables
the feature for all projects on the machine
* **Option 2**: Add `enable-my-feature: true` in their `pubspec.yaml`,
under the `flutter` section. This would enable the for a single project
on the machine.

Turning on a feature affects _both_ development-time (`flutter run`) and
deployment-time (`flutter build x`). For example, I can `flutter build
windows` to create an `.exe` with multi-window features enabled.

## How this works

This adds a new
[`runtimeId`](https://github.com/flutter/flutter/pull/168437/files#diff-0ded384225f19a4c34d43c7c11f7cb084ff3db947cfa82d8d52fc94c112bb2a7R243-R247)
property to the tool's `Feature` class. If a feature is on and has a
`runtimeId`, its `runtimeId` will be [stamped into the Dart application
as a Dart
define](https://github.com/flutter/flutter/pull/168437/files#diff-bd662448bdc2e6f50e47cd3b20b22b41a828561bce65cb4d54ea4f5011cc604eR293-R327).
The framework uses this Dart define to [determine which features are
enabled](https://github.com/flutter/flutter/pull/168437/files#diff-c8dbd5cd3103bc5be53c4ac5be8bdb9bf73e10cd5d8e4ac34e737fd1f8602d45).

### Multi-window example

https://github.com/flutter/flutter/pull/168697 shows how this new
feature flag system can be used to add a multi-window feature flag:

1. It adds a new [multi-window
feature](https://github.com/flutter/flutter/pull/168697/files#diff-0ded384225f19a4c34d43c7c11f7cb084ff3db947cfa82d8d52fc94c112bb2a7R189-R198)
to the Flutter tool. This can be turned on using `flutter config
--enable-multi-window` or by putting `enable-multi-window: true` in an
app's .pubspec, under the `flutter` section.
2. It adds a new
[`isMultiWindowEnabled`](https://github.com/flutter/flutter/pull/168697/files#diff-c8dbd5cd3103bc5be53c4ac5be8bdb9bf73e10cd5d8e4ac34e737fd1f8602d45R7-R11)
property to the framework.
3. The Material library can use this new property to determine whether
it should create a new window.
[Example](https://github.com/flutter/flutter/pull/168697/files#diff-2cbc1634ed6b61d61dfa090e7bfbbb7c60b74c8abc3a28df6f79eee691fd1b73).

## Limitations

### Tool and framework only

For now, these feature flags are available only to the Flutter tool and
Flutter framework. The flags are not automatically available to the
embedder or the engine.

For example, embedders need to configure their surfaces differently if
Impeller is enabled. This configuration must happen before the Dart
isolate is launched. As a result, the framework's feature flags is not a
viable solution for this scenario for now. For these kinds of scenarios,
we should continue to use platform-specific configuration like the
`AndroidManifest.xml` or `Info.plist` files.

This is a fixable limitation, we just need to invest in this plumbing :)

### Tree shaking

Feature flags are not designed to help tree shaking. For example, you
cannot conditionally import Dart code depending on the enabled feature
flags. Code that is feature flagged off will still be imported into
user's apps.

## 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.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-02 17:13:53 +00:00
Reid Baker
1dfb59d281
Android min sdk 24 part 1 (#170882)
- **bump template version, update migration code to handle api 21-23 and
expand it to cover multiple min api level definitions**
- **bump add to app project to minimum api level 24**
- **PathUtilsTest converted to using config, removed test code that
branched on versions older than 24**
- **Update additional build.gradle files to have minsdk 24 and
documenation**

Related to #170807

G3 cls 
- espresso https://critique.corp.google.com/cl/776592881
- integration tests cl/778034198
- removal of pre api 23 samples tests cl/777652802


## 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: Gray Mackall <34871572+gmackall@users.noreply.github.com>
2025-07-02 14:30:22 +00:00
Ben Konyi
4937e469d6
[ Tool ] Update validator of NO_PROXY to explicitly match detected hosts (#171385)
Fixes https://github.com/flutter/flutter/issues/35598
2025-07-02 13:59:09 +00:00
Ben Konyi
8d58596bd9
[ Tool ] Change name of test classes that don't extend Mock from Mock* to Fake* (#171380)
Fixes https://github.com/flutter/flutter/issues/33274
2025-07-02 13:59:09 +00:00
Matan Lurey
1c3afdf630
Address some comments from #38632 (2019) if they still apply (#171461)
Closes https://github.com/flutter/flutter/pull/38632.

Mostly clarifies how validation works, and reuses some code.
2025-07-02 03:10:20 +00:00
Mohellebi abdessalem
d3e5417310
remove x86 unused codepaths (#170191)
Towards #170142
## 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 `///`).
- [ ] 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.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com>
2025-07-01 21:24:52 +00:00
Brandon DeRosier
a0711824a5
Add --enable-flutter-gpu flag to flutter_tool & FLTEnableFlutterGPU to the macOS embedder (#171404)
Resolves https://github.com/flutter/flutter/issues/168126
Resolves https://github.com/flutter/flutter/issues/171361
Resolves https://github.com/bdero/flutter-scene-example/issues/9

FLTEnableFlutterGPU was added for iOS and Android in
https://github.com/flutter/flutter/pull/165337 along with a setting in
the engine. This patch adds macOS support and allows the flag to be
overridden by passing `--enable-flutter-gpu` to the Flutter tool.
2025-07-01 18:27:50 +00:00
Matan Lurey
ad722a2973
Add -v to flutter doctor for crash reporting (#171308)
Towards https://github.com/flutter/flutter/issues/38901.
2025-07-01 17:48:00 +00:00
Matan Lurey
4fbc812a47
Add feature flags to flutter doctor -v (#171307)
Towards https://github.com/flutter/flutter/issues/38901.
2025-07-01 15:44:09 +00:00
Matan Lurey
b524df28bd
Report feature flags enabled if the flutter tool crashes on a bot. (#171304)
Towards https://github.com/flutter/flutter/issues/38901.

Next PR will also add feature flags to `flutter doctor`.
2025-07-01 15:44:09 +00:00
Matan Lurey
1a967e0d63
Remove a doctor event from the package:usage-era. (#171305)
No test because it's just unused.
2025-07-01 15:44:09 +00:00
Reid Baker
1b075f6b18
Android gradle use lowercase instead of toLowerCase in preparation for removal in v9 (#171397)
partial resolution for #170791 (lowercase but not filemode) 

This is the first time I have used the experimental api annotation. Most
users should have lowercase available without the annotation only the
oldest kotlin/agp versions should need the annotation.

## 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.
2025-07-01 15:10:12 +00:00
Mouad Debbar
dc56ed81da
Run expression_evaluation_web_ddc_library_bundle_test.dart on Mac/Windows (#171278)
Part of https://github.com/flutter/flutter/issues/171276
2025-06-30 14:59:32 +00:00
flutter-pub-roller-bot
e3e51935dd
Roll pub packages (#171091)
This PR was generated by `flutter update-packages --force-upgrade`.
2025-06-30 14:31:25 +00:00
Nate Biggs
85486ffffc
Allow minification to be toggled for wasm builds (#171211)
Provides extra minification controls for web builds. Updates the
existing `--minify` flag to pass its value to both JS and wasm (instead
of just JS).

Also adds two new flags `--minify-js` and `--minify-wasm` which toggle
minification for just one of the web targets. While JS minification has
a huge impact on code size, wasm minification has a much smaller effect
on the program's size. Since minification can obfuscate useful info
(like errors) one may want to turn off minification for wasm but leave
it on for JS.

The plan is to temporarily use `--no-minify-wasm` for devtools to help
debug some exceptions being seen.

---------

Co-authored-by: Nate Biggs <natebiggs@google.com>
2025-06-28 17:46:44 +00:00
Matan Lurey
1d93621ed4
Ensure flutter_tools's pubspec.lock is newer than pubspec.yaml (#171300)
Closes https://github.com/flutter/flutter/issues/171024.
2025-06-27 22:26:32 +00:00