-
Notifications
You must be signed in to change notification settings - Fork 29.8k
[ Widget Preview ] Pass DTD URI as a constant in a generated file #179821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ Widget Preview ] Pass DTD URI as a constant in a generated file #179821
Conversation
Passing the DTD URI via a Dart define results in a new `<hash>.cache.dill.track.dill` being created on each run as the DTD URI is never the same and the `cache.dill.track.dill` hash is partly based on the set of Dart defines. These files are not cleaned up automatically, so they could take up a significant amount of memory over time. This change adds an additional code generation step to the widget previewer which populates `widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dart` with a constant containing the DTD URI provided by the tool. Fixes flutter#179139
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors how the Dart Tooling Daemon (DTD) URI is passed to the widget previewer. Instead of using a Dart define, which caused issues with cache invalidation, it now uses a code generation step to create a file with a constant for the DTD URI. This is a good improvement that should prevent unnecessary cache file generation.
My review includes suggestions for adding documentation to new public members as per the style guide, and a minor formatting fix to add a newline at the end of new files.
packages/flutter_tools/lib/src/widget_preview/preview_code_generator.dart
Show resolved
Hide resolved
packages/flutter_tools/lib/src/widget_preview/preview_code_generator.dart
Show resolved
Hide resolved
...es/flutter_tools/templates/widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dart.tmpl
Show resolved
Hide resolved
...t/widget_preview_scaffold.shard/widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dart
Show resolved
Hide resolved
DanTup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
…utter#179821) Passing the DTD URI via a Dart define results in a new `<hash>.cache.dill.track.dill` being created on each run as the DTD URI is never the same and the `cache.dill.track.dill` hash is partly based on the set of Dart defines. These files are not cleaned up automatically, so they could take up a significant amount of memory over time. This change adds an additional code generation step to the widget previewer which populates `widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dart` with a constant containing the DTD URI provided by the tool. Fixes flutter#179139
…utter#179821) Passing the DTD URI via a Dart define results in a new `<hash>.cache.dill.track.dill` being created on each run as the DTD URI is never the same and the `cache.dill.track.dill` hash is partly based on the set of Dart defines. These files are not cleaned up automatically, so they could take up a significant amount of memory over time. This change adds an additional code generation step to the widget previewer which populates `widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dart` with a constant containing the DTD URI provided by the tool. Fixes flutter#179139
Roll Flutter from 6e1aa82 to d81baab (47 revisions) flutter/flutter@6e1aa82...d81baab 2025-12-16 68449066+zijiehe-google-com@users.noreply.github.com Revert "chore: linux fuchsia tests are flaking" (flutter/flutter#179897) 2025-12-15 planetmarshall@users.noreply.github.com add default-linux-sysroot to gn frontend args (flutter/flutter#179303) 2025-12-15 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#179751) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from 783ce2077e46 to 6903a4e65c3f (2 revisions) (flutter/flutter#179903) 2025-12-15 adilhanney@disroot.org Add `Adwaita Sans` as a font fallback on Linux (flutter/flutter#179144) 2025-12-15 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Unmodified android sdk bundle (#179647)" (flutter/flutter#179904) 2025-12-15 robert.ancell@canonical.com Update window settings as they change rather than the more outdated "Apply" pattern. (flutter/flutter#179861) 2025-12-15 49699333+dependabot[bot]@users.noreply.github.com Bump dessant/lock-threads from 5.0.1 to 6.0.0 in the all-github-actions group (flutter/flutter#179901) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from 9decbd4c216b to 783ce2077e46 (2 revisions) (flutter/flutter#179896) 2025-12-15 34871572+gmackall@users.noreply.github.com Unmodified android sdk bundle (flutter/flutter#179647) 2025-12-15 mdebbar@google.com [web] Fix `resizeToAvoidBottomInset` on Android web (flutter/flutter#179581) 2025-12-15 iliyazelenkog@gmail.com Suppress deprecation warning for AChoreographer_postFrameCallback (flutter/flutter#178580) 2025-12-15 planetmarshall@users.noreply.github.com remove unnecessary virtual destructor from VertexDescriptor (flutter/flutter#178682) 2025-12-15 engine-flutter-autoroll@skia.org Roll Dart SDK from b245f6022727 to 20d114f951db (1 revision) (flutter/flutter#179893) 2025-12-15 jason-simmons@users.noreply.github.com [Impeller] Delete GLES framebuffer objects only on the thread where they were created (flutter/flutter#179768) 2025-12-15 jason-simmons@users.noreply.github.com [Impeller] Convert paths in ImpellerC command line flags to std::filesystem::path objects (flutter/flutter#179717) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from 5e1ff611b36b to 9decbd4c216b (2 revisions) (flutter/flutter#179890) 2025-12-15 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from DtfDWAx6t_CsD2e1W... to 433KtmJvbMyaDMJvD... (flutter/flutter#179889) 2025-12-15 116356835+AbdeMohlbi@users.noreply.github.com Remove unnecessary unboxing in `FlutterLoader.java` (flutter/flutter#179869) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from f04f8ca3b284 to 5e1ff611b36b (1 revision) (flutter/flutter#179882) 2025-12-15 engine-flutter-autoroll@skia.org Roll Packages from 0ac7a03 to 2cd921c (1 revision) (flutter/flutter#179885) 2025-12-15 bkonyi@google.com [ Widget Preview ] Pass DTD URI as a constant in a generated file (flutter/flutter#179821) 2025-12-15 116356835+AbdeMohlbi@users.noreply.github.com Bump minSdk to `24` in `engine` (flutter/flutter#175508) 2025-12-15 engine-flutter-autoroll@skia.org Roll Dart SDK from bca8bb37d95f to b245f6022727 (1 revision) (flutter/flutter#179879) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from eb1347d18957 to f04f8ca3b284 (1 revision) (flutter/flutter#179876) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from 41bcfb848b13 to eb1347d18957 (1 revision) (flutter/flutter#179871) 2025-12-15 engine-flutter-autoroll@skia.org Roll Skia from d194c3b7a9a9 to 41bcfb848b13 (6 revisions) (flutter/flutter#179866) 2025-12-14 robert.ancell@canonical.com Remove obsolete windowing channel (flutter/flutter#179718) 2025-12-14 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from SCLq31whvg8nJvuYE... to DtfDWAx6t_CsD2e1W... (flutter/flutter#179856) 2025-12-14 engine-flutter-autoroll@skia.org Roll Skia from 5d98ce0af031 to d194c3b7a9a9 (1 revision) (flutter/flutter#179854) 2025-12-13 engine-flutter-autoroll@skia.org Roll Skia from f9b242d9a365 to 5d98ce0af031 (1 revision) (flutter/flutter#179843) 2025-12-13 engine-flutter-autoroll@skia.org Roll Skia from abe90c72cf56 to f9b242d9a365 (1 revision) (flutter/flutter#179838) 2025-12-13 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from fppT9ZrwbFx7iYrIh... to SCLq31whvg8nJvuYE... (flutter/flutter#179836) 2025-12-13 engine-flutter-autoroll@skia.org Roll Dart SDK from 34654f2a3baa to bca8bb37d95f (1 revision) (flutter/flutter#179835) 2025-12-13 engine-flutter-autoroll@skia.org Roll Skia from 9e7c893bb593 to abe90c72cf56 (1 revision) (flutter/flutter#179830) 2025-12-13 engine-flutter-autoroll@skia.org Roll Dart SDK from f105c2168574 to 34654f2a3baa (1 revision) (flutter/flutter#179823) 2025-12-13 97480502+b-luk@users.noreply.github.com Add FilterQuality parameter to FragmentShader.setImageSampler (flutter/flutter#179760) 2025-12-13 evanwall@buffalo.edu Add profiling counts to pipeline uses (flutter/flutter#179374) 2025-12-13 engine-flutter-autoroll@skia.org Roll Skia from edf52cb27f29 to 9e7c893bb593 (3 revisions) (flutter/flutter#179819) 2025-12-12 jacksongardner@google.com Update Skwasm to engine style guidelines. (flutter/flutter#179756) 2025-12-12 engine-flutter-autoroll@skia.org Roll Dart SDK from 9a65db770758 to f105c2168574 (5 revisions) (flutter/flutter#179814) 2025-12-12 engine-flutter-autoroll@skia.org Roll Skia from f23b00a407a4 to edf52cb27f29 (5 revisions) (flutter/flutter#179807) 2025-12-12 97480502+b-luk@users.noreply.github.com Use depth buffer to implement geometry overdraw protection (flutter/flutter#179426) 2025-12-12 nshahan@google.com [flutter_tool] Force UTF-8 character set for dev (flutter/flutter#179419) 2025-12-12 engine-flutter-autoroll@skia.org Roll Skia from e66816c3645e to f23b00a407a4 (2 revisions) (flutter/flutter#179798) 2025-12-12 30870216+gaaclarke@users.noreply.github.com Implements decodeImageFromPixelsSync (flutter/flutter#179519) ...
Passing the DTD URI via a Dart define results in a new
<hash>.cache.dill.track.dillbeing created on each run as the DTD URI is never the same and thecache.dill.track.dillhash is partly based on the set of Dart defines. These files are not cleaned up automatically, so they could take up a significant amount of memory over time.This change adds an additional code generation step to the widget previewer which populates
widget_preview_scaffold/lib/src/dtd/dtd_connection_info.dartwith a constant containing the DTD URI provided by the tool.Fixes #179139