Skip to content

[flutter_tools] Include dev_dependencies hooks for release integration tests - #193436

Merged
auto-submit[bot] merged 1 commit into
flutter:masterfrom
dcharkes:data-assets-dev-dependencies-release-test
Oct 12, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:masterfrom
dcharkes:data-assets-dev-dependencies-release-test

Conversation

@dcharkes

@dcharkes dcharkes commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

When running release-mode tests (such as flutter test integration_test --release), createFlutterNativeAssetsBuildRunner previously set includeDevDependencies = !buildMode.isRelease, which excluded hooks from dev_dependencies.

Bug:

Changes

  • Check _isTestTarget(environment) (whether kTargetFile is under integration_test/, test_driver/, or test/) so includeDevDependencies is true for test targets even in release mode.
  • Add a unit test in native_assets_test.dart verifying includeDevDependencies is false for lib/main.dart in release mode and true for integration_test/app_test.dart, test_driver/app.dart, and test/app_test.dart.

PR Stack

# PR Branch Commit
1 #193434 data-assets-empty-pubspec ab37f42
2 #193435 data-assets-flutter-test 4956c97
3 👉 #193436 (this PR) data-assets-dev-dependencies-release-test 596124d
4 #193437 data-assets-widget-preview bd246d9

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • 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 in-code documentation (doc comments with ///).
  • If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed).
  • 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.
  • All existing and new tests are passing.

);
}

bool _isTestTarget(Environment environment) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@bkonyi I am surprised we have nothing like this yet in the codebase. It seems that the usual logic on dev deps or not is dependent on release mode, but that is too strict if you want to use dev deps in tests or integration tests in release mode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • There is no existing shared helper in flutter_tools that checks whether kTargetFile is a test target across integration_test/, test_driver/, and test/:
    • _shouldRunAsIntegrationTests in test.dart only checks integration_test/.
    • DriveCommand.runCommand in drive.dart only checks _fileSystem.path.isWithin('test_driver', targetFile) for an error message.
    • RunCommand in run.dart only checks targetFile.endsWith('_test.dart') for analytics.
    • The closest related helper in flutter_tools is PackageConfigWorkspaceExtension.toPackageUriForWorkspace (used in WebEntrypointTarget.build and KernelCompiler.compile), which returns null whenever the entrypoint is outside lib/.

@dcharkes dcharkes added the CICD Run CI/CD label Sep 28, 2026
@dcharkes
dcharkes requested a review from bkonyi September 28, 2026 10:20
pull Bot pushed a commit to phamminhphuc/flutter that referenced this pull request Sep 28, 2026
…mpty (flutter#193434)

When `flutterManifest.isEmpty` (for example, a `pubspec.yaml` without a
`flutter:` section), `ManifestAssetBundle.build` previously returned
early with an empty `AssetManifest.bin`, ignoring any data assets
produced by build/link hooks (`flutterHookResult.dataAssets`).

Bug:

* flutter#146264

### Changes
- Only short-circuit with an empty manifest in
`ManifestAssetBundle.build` when both `flutterManifest.isEmpty` and
`flutterHookResult?.dataAssets.isEmpty ?? true`.
- Skip `computeTransitiveDependencies` when `flutterManifest.isEmpty`.
- Add a unit test in `asset_bundle_test.dart` verifying that data assets
from hooks are bundled when `pubspec.yaml` is empty.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| **1** | **👉 flutter#193434 (this PR)**
| `data-assets-empty-pubspec` |
flutter@62199c4
|
| 2 | flutter#193435 |
`data-assets-flutter-test` |
flutter@25be1ab
|
| 3 | flutter#193436 |
`data-assets-dev-dependencies-release-test` |
flutter@79abad9
|
| 4 | flutter#193437 |
`data-assets-widget-preview` |
flutter@98f1001
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
@dcharkes
dcharkes force-pushed the data-assets-dev-dependencies-release-test branch 6 times, most recently from 4e9c425 to 76799a8 Compare October 1, 2026 09:40
mattkae pushed a commit to canonical/flutter that referenced this pull request Oct 1, 2026
…r#193435)

Previously, `flutter test` ran native assets hooks via
`TestCompilerNativeAssetsBuilder.build(buildInfo)`, which only returned
the `NativeAssetsManifest.json` URI and discarded the
`FlutterHookResult` containing hook-generated data assets.

Bug:

* flutter#146264

### Changes
- Add `buildWithHookResult` to `TestCompilerNativeAssetsBuilder`
returning both `nativeAssetsManifest` and `flutterHookResult`.
- Pass `flutterHookResult` to `_buildTestAsset` / `assetBundle.build` in
`TestCommand`.
- Update `TestCommand._needsRebuild` to check if bundled asset files
exist on disk, guard `pub.existsSync()`, and check
`flutterHookResult.dependencies` modification timestamps.
- Add a hermetic test in `test_test.dart` verifying that `flutter test`
bundles data assets from hooks into `build/unit_test_assets`.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| 1 | flutter#193434 |
`data-assets-empty-pubspec` |
flutter@62199c4
|
| **2** | **👉 flutter#193435 (this PR)**
| `data-assets-flutter-test` |
flutter@390c757
|
| 3 | flutter#193436 |
`data-assets-dev-dependencies-release-test` |
flutter@cca04e9
|
| 4 | flutter#193437 |
`data-assets-widget-preview` |
flutter@0a5a8e9
|

> **Note:** This PR is stacked on
flutter#193434. To review only this PR's
diff before the base PR lands, view commit
flutter@390c757.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
@dcharkes
dcharkes force-pushed the data-assets-dev-dependencies-release-test branch from 76799a8 to bd93510 Compare October 2, 2026 14:33
@dcharkes
dcharkes marked this pull request as ready for review October 2, 2026 14:37

@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 updates the native assets build runner to include dev dependencies for release test targets, such as those located in the integration_test, test_driver, or test directories, and adds corresponding tests. Feedback suggests wrapping the relative path calculation in a try-catch block to prevent potential PathException crashes on Windows when paths are on different drives, as well as using triple-slash (///) comments for private member documentation per the style guide.

Comment on lines +426 to +441
bool _isTestTarget(Environment environment) {
final String? targetFile = environment.defines[kTargetFile];
if (targetFile == null) {
return false;
}
final String absoluteTargetPath = environment.fileSystem.path.isAbsolute(targetFile)
? targetFile
: environment.fileSystem.path.join(environment.projectDir.path, targetFile);
final String relativePath = environment.fileSystem.path.relative(
environment.fileSystem.path.normalize(absoluteTargetPath),
from: environment.projectDir.path,
);
final List<String> parts = environment.fileSystem.path.split(relativePath);
return parts.isNotEmpty &&
const <String>{'integration_test', 'test_driver', 'test'}.contains(parts.first);
}

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.

medium

To prevent potential crashes on Windows when targetFile and environment.projectDir.path are on different drives (which causes path.relative to throw a PathException), we should wrap the relative path computation in a try-catch block.

Additionally, per the Flutter Style Guide, we should use /// for public-quality documentation, even on private members.

/// Returns whether the target file in the [environment] is a test target.
///
/// This checks if the target file is located within the test, test_driver,
/// or integration_test directories of the project.
bool _isTestTarget(Environment environment) {
  final String? targetFile = environment.defines[kTargetFile];
  if (targetFile == null) {
    return false;
  }
  final String absoluteTargetPath = environment.fileSystem.path.isAbsolute(targetFile)
      ? targetFile
      : environment.fileSystem.path.join(environment.projectDir.path, targetFile);
  try {
    final String relativePath = environment.fileSystem.path.relative(
      environment.fileSystem.path.normalize(absoluteTargetPath),
      from: environment.projectDir.path,
    );
    final List<String> parts = environment.fileSystem.path.split(relativePath);
    return parts.isNotEmpty &&
        const <String>{'integration_test', 'test_driver', 'test'}.contains(parts.first);
  } catch (_) {
    return false;
  }
}
References
  1. Use /// for public-quality documentation, even on private members. (link)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

path.relative across drives on Windows (try-catch) — False (Python hallucination):

  • Unlike Python's os.path.relpath (which raises ValueError across drives), Dart's package:path Context.relative does not throw a PathException when two absolute paths are on different Windows drives (C:\... vs D:\...).
  • Instead, package:path checks if (fromParsed.root != pathParsed.root) return path; and simply returns D:\... unchanged, so parts.first is 'D:\\' and _isTestTarget returns false.
  • (Context.relative only throws PathException if a root-relative Windows path like \foo without a drive letter is compared against C:\bar when current has no drive letter.)

bkonyi
bkonyi previously approved these changes Oct 5, 2026

@bkonyi bkonyi 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.

LGTM overall with one question.

}

testUsingContext(
'createFlutterNativeAssetsBuildRunner includes dev dependencies for release test targets',

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.

Do we need another case here for test/?

@dcharkes
dcharkes force-pushed the data-assets-dev-dependencies-release-test branch from bd93510 to 596124d Compare October 6, 2026 08:15
@dcharkes
dcharkes requested a review from bkonyi October 6, 2026 08:35

@bkonyi bkonyi 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.

LGTM!

@dcharkes dcharkes added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 12, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Oct 12, 2026
Merged via the queue into flutter:master with commit 416d09a Oct 12, 2026
24 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 12, 2026
This was referenced Oct 12, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 14, 2026
…#13220)

Manual roll Flutter from d03768eef055 to 4249ccbc18a3 (158 revisions)

Manual roll requested by [email protected]

flutter/flutter@d03768e...4249ccb

2026-10-12 [email protected] [AGP 9.1.0 Migration #8] Unify add-to-app module wiring on the variant API (flutter/flutter#193717)
2026-10-12 [email protected] [master] Update Flutter DEPS to Dart 5933cb486b4aef2f8cf6b9f89a5651c0d5b0955e (flutter/flutter#193982)
2026-10-12 [email protected] [Android] Fix use-after-free of SurfaceControl.Transaction in HCPP (flutter/flutter#192969)
2026-10-12 [email protected] [windows] Add OpenGL compositor tests against ANGLE at D3D11 feature level 10_0 (flutter/flutter#194114)
2026-10-12 [email protected] Fix HDR image packing for ios (flutter/flutter#192526)
2026-10-12 [email protected] Bump customer tests to pick up material_ui and cupertino_ui (flutter/flutter#194236)
2026-10-12 [email protected] Remove no-shuffle from text_field_test.dart (flutter/flutter#193550)
2026-10-12 [email protected] [web] Clip semantics DOM text labels to stop stealing taps (flutter/flutter#194011)
2026-10-12 [email protected] Roll Skia from 9b6ceba4728d to 17f6986c226c (6 revisions) (flutter/flutter#194232)
2026-10-12 [email protected] [web] Skip non-focusable containers in Focusable.focusAsRouteDefault (flutter/flutter#194138)
2026-10-12 [email protected] [web_paragraph] Honor kTextHeightNone in TextStyle and ParagraphStyle (flutter/flutter#193733)
2026-10-12 [email protected] Roll Skia from c88b49d1d6c7 to 9b6ceba4728d (4 revisions) (flutter/flutter#194226)
2026-10-12 [email protected] Migrate remaining test to macOS 26 (flutter/flutter#193825)
2026-10-12 [email protected] Roll Dart SDK from 047ca322aa9c to 221363557163 (1 revision) (flutter/flutter#194219)
2026-10-12 [email protected] [flutter_tools] Include dev_dependencies hooks for release integration tests (flutter/flutter#193436)
2026-10-12 [email protected] Roll Skia from d8afad1b1829 to c88b49d1d6c7 (1 revision) (flutter/flutter#194198)
2026-10-12 [email protected] Roll Skia from b23ddbff1265 to d8afad1b1829 (4 revisions) (flutter/flutter#194195)
2026-10-11 [email protected] Roll Skia from a168863e44ec to b23ddbff1265 (1 revision) (flutter/flutter#194185)
2026-10-11 [email protected] Roll Skia from 0c1d93abfa04 to a168863e44ec (1 revision) (flutter/flutter#194181)
2026-10-11 [email protected] iOS: Re-enable rendering on willEnterForeground (flutter/flutter#191350)
2026-10-11 [email protected] Roll Skia from 93c9d3ffda25 to 0c1d93abfa04 (1 revision) (flutter/flutter#194179)
2026-10-11 [email protected] Remove more instances of deprecated `withOpacity` (flutter/flutter#193559)
2026-10-11 [email protected] Fix another `parameter_assignments` warning (flutter/flutter#193669)
2026-10-11 [email protected] Roll Skia from 3136abef8f58 to 93c9d3ffda25 (1 revision) (flutter/flutter#194169)
2026-10-11 [email protected] [Impeller] Guard the sampler library caches with a mutex (flutter/flutter#193738)
2026-10-11 [email protected] Roll Dart SDK from e9c89888bcc1 to 047ca322aa9c (1 revision) (flutter/flutter#194157)
2026-10-10 [email protected] Roll Dart SDK from 787baa8aae78 to e9c89888bcc1 (2 revisions) (flutter/flutter#194141)
2026-10-10 [email protected] Fix OverlayPortal layout in shrink-wrapped overlays (flutter/flutter#193079)
2026-10-10 [email protected] Roll Skia from 353076e27b1c to 3136abef8f58 (1 revision) (flutter/flutter#194130)
2026-10-10 [email protected] Roll Dart SDK from 88a07589b1ff to 787baa8aae78 (1 revision) (flutter/flutter#194124)
2026-10-10 [email protected] Route windowing view lookups through WidgetsBinding (flutter/flutter#192666)
2026-10-10 [email protected] Roll Dart SDK from 2a06cab34715 to 88a07589b1ff (1 revision) (flutter/flutter#194117)
2026-10-10 [email protected] Roll Skia from f9043b7aa798 to 353076e27b1c (2 revisions) (flutter/flutter#194115)
2026-10-10 [email protected] Refactored PipelineLibraryGLES (flutter/flutter#193985)
2026-10-09 [email protected] add shorthands for scroll physics subclasses in framework (flutter/flutter#193082)
2026-10-09 [email protected] Roll Dart SDK from ba889e3cee8a to 2a06cab34715 (1 revision) (flutter/flutter#194105)
2026-10-09 [email protected] Roll Skia from 5ea03d8a53a6 to f9043b7aa798 (2 revisions) (flutter/flutter#194099)
2026-10-09 [email protected] Add docs for using bb and led with LUCI (flutter/flutter#193859)
2026-10-09 [email protected] Roll Skia from e329bb617820 to 5ea03d8a53a6 (5 revisions) (flutter/flutter#194087)
2026-10-09 [email protected] Roll Packages from 54706bd to d8d9e97 (5 revisions) (flutter/flutter#194080)
2026-10-09 [email protected] Move the Vulkan wrapped-texture helper out of the GPU surface (flutter/flutter#193001)
2026-10-09 [email protected] Roll Skia from 3e54bcf4c963 to e329bb617820 (1 revision) (flutter/flutter#194078)
2026-10-09 [email protected] Roll Dart SDK from 23f0308f9af8 to ba889e3cee8a (2 revisions) (flutter/flutter#194077)
2026-10-09 [email protected] Bump dartdoc to 9.0.11 (flutter/flutter#194076)
...
ahmedm-gh pushed a commit to ahmedm-gh/flutter that referenced this pull request Oct 14, 2026
…r#193437)

Previously, `PreviewDetector` and `LspPreviewDetector` ignored
modifications to non-Dart files (and Dart files outside the analysis
context, such as hook scripts), and
`FlutterHookResult._wasAnyFileModifiedSince` did not treat deleted files
(`FileSystemEntityType.notFound`) as modified.

Bug:

* flutter#146264

### Changes
- Add `onNonDartFileChangeDetected` callback to `PreviewDetector` and
`LspPreviewDetector`, wired up in `WidgetPreviewStartCommand` to trigger
a preview app restart when `assetBundle.needsBuild()` is `true`.
- Treat `FileSystemEntityType.notFound` as modified in
`FlutterHookResult._wasAnyFileModifiedSince`.
- Update `lsp_preview_detector_test.dart` and `asset_bundle_test.dart`.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| 1 | flutter#193434 |
`data-assets-empty-pubspec` |
flutter@ab37f42
|
| 2 | flutter#193435 |
`data-assets-flutter-test` |
flutter@4956c97
|
| 3 | flutter#193436 |
`data-assets-dev-dependencies-release-test` |
flutter@416d09a
|
| **4** | **👉 flutter#193437 (this PR)**
| `data-assets-widget-preview` |
flutter@431b96e
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…r#193435)

Previously, `flutter test` ran native assets hooks via
`TestCompilerNativeAssetsBuilder.build(buildInfo)`, which only returned
the `NativeAssetsManifest.json` URI and discarded the
`FlutterHookResult` containing hook-generated data assets.

Bug:

* flutter#146264

### Changes
- Add `buildWithHookResult` to `TestCompilerNativeAssetsBuilder`
returning both `nativeAssetsManifest` and `flutterHookResult`.
- Pass `flutterHookResult` to `_buildTestAsset` / `assetBundle.build` in
`TestCommand`.
- Update `TestCommand._needsRebuild` to check if bundled asset files
exist on disk, guard `pub.existsSync()`, and check
`flutterHookResult.dependencies` modification timestamps.
- Add a hermetic test in `test_test.dart` verifying that `flutter test`
bundles data assets from hooks into `build/unit_test_assets`.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| 1 | flutter#193434 |
`data-assets-empty-pubspec` |
flutter@62199c4
|
| **2** | **👉 flutter#193435 (this PR)**
| `data-assets-flutter-test` |
flutter@390c757
|
| 3 | flutter#193436 |
`data-assets-dev-dependencies-release-test` |
flutter@cca04e9
|
| 4 | flutter#193437 |
`data-assets-widget-preview` |
flutter@0a5a8e9
|

> **Note:** This PR is stacked on
flutter#193434. To review only this PR's
diff before the base PR lands, view commit
flutter@390c757.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…n tests (flutter#193436)

When running release-mode tests (such as `flutter test integration_test
--release`), `createFlutterNativeAssetsBuildRunner` previously set
`includeDevDependencies = !buildMode.isRelease`, which excluded hooks
from `dev_dependencies`.

Bug:

* flutter#146264

### Changes
- Check `_isTestTarget(environment)` (whether `kTargetFile` is under
`integration_test/`, `test_driver/`, or `test/`) so
`includeDevDependencies` is `true` for test targets even in release
mode.
- Add a unit test in `native_assets_test.dart` verifying
`includeDevDependencies` is `false` for `lib/main.dart` in release mode
and `true` for `integration_test/app_test.dart`, `test_driver/app.dart`,
and `test/app_test.dart`.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| 1 | flutter#193434 |
`data-assets-empty-pubspec` |
flutter@ab37f42
|
| 2 | flutter#193435 |
`data-assets-flutter-test` |
flutter@4956c97
|
| **3** | **👉 flutter#193436 (this PR)**
| `data-assets-dev-dependencies-release-test` |
flutter@596124d
|
| 4 | flutter#193437 |
`data-assets-widget-preview` |
flutter@bd246d9
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
…r#193437)

Previously, `PreviewDetector` and `LspPreviewDetector` ignored
modifications to non-Dart files (and Dart files outside the analysis
context, such as hook scripts), and
`FlutterHookResult._wasAnyFileModifiedSince` did not treat deleted files
(`FileSystemEntityType.notFound`) as modified.

Bug:

* flutter#146264

### Changes
- Add `onNonDartFileChangeDetected` callback to `PreviewDetector` and
`LspPreviewDetector`, wired up in `WidgetPreviewStartCommand` to trigger
a preview app restart when `assetBundle.needsBuild()` is `true`.
- Treat `FileSystemEntityType.notFound` as modified in
`FlutterHookResult._wasAnyFileModifiedSince`.
- Update `lsp_preview_detector_test.dart` and `asset_bundle_test.dart`.

### PR Stack
| # | PR | Branch | Commit |
| :-: | :--- | :--- | :--- |
| 1 | flutter#193434 |
`data-assets-empty-pubspec` |
flutter@ab37f42
|
| 2 | flutter#193435 |
`data-assets-flutter-test` |
flutter@4956c97
|
| 3 | flutter#193436 |
`data-assets-dev-dependencies-release-test` |
flutter@416d09a
|
| **4** | **👉 flutter#193437 (this PR)**
| `data-assets-widget-preview` |
flutter@431b96e
|

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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 in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [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.
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.

2 participants