mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This change reworks how preview detection is performed to allow for identifying libraries which contain compile-time errors or transitive dependencies with compile-time errors. Previously, introducing a compile-time error into a preview containing library's dependency chain would result in the preview environment no longer being updated due to a failed compilation during hot reload. Users would first need to know to fix the compilation error before being able to make updates to previews. With this change, the preview detector builds and maintains a dependency graph, propagating errors from libraries to their upstream dependencies. If a file containing a preview would fail to compile, it is no longer inserted into the widget preview environment. In its place, an error message is displayed informing the user that there's a compilation error in a library that needs to be fixed first. This change needs some follow up work to create a proper UI for displaying the compilation error messaging, batch processing of bulk file system operations (e.g., directory deletion) to avoid performance issues, and some refactoring. Work towards #166430