-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Resolve contradictions about deferred loading between Dart and Flutter #7117
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
Comments
I just run into the same situation that I'm confused about the documentation. What is the current status? When you change the documentation, it might me worth to mention how to create that libraries. This is still a mystery for me. Not sure if helpful, but that documentation is hosted here: https://github.com/dart-lang/site-www/blob/main/src/_guides/language/language-tour.md#lazily-loading-a-library Based on git blame this part of the documentation was not touched for 3 years! |
I still don't understand where the web platform stands in regards to this feature. It sounds like if you use |
@ditman, can you clarify? |
AFAIK deferred loading is supported on the web. It is used extensively in the Gallery app:
I am not an expert on this, but AFAIK there's nothing special needed to do when compiling a Flutter web app: |
I ran into the same issue as this bug! Thanks for filing, Elliott! So how about updating https://dart.dev/language/libraries#lazily-loading-a-library to explain that web and Android both support deferred loading. And then update https://docs.flutter.dev/perf/deferred-components to explain that Web and Android both support this in Dart, but the setup will be different for each platform. |
@munificent: Any ideas as to why Dart docs contradict in this case? |
No idea. Deferred loading is mostly a mystery to me. Maybe @lrhn, @eernst, or @leafpetersen would know? |
My bet is that the feature was released, and then we forgot to properly update this bit of documentation :) |
I have no idea what the status of deferred loading on the VM is. We should ask the VM people. From the language's perspective, deferred loading has no effect on program semantics, other than restricting what you can do with deferred types and constants (can't use than as such), and allowing accesses through the prefix to throw until For AOT, deferred loading is a deployment issue, more than a compilation issue. If the runtime doesn't have a compiler, it needs some way to introduce the support for the already compiled accesses to deferred declarations. I guess Flutter has done that. |
AFAIK: The VM supports deferred loading. Our AOT compiler can be told to emit deferred components and our AOT runtime will then ask the embedder (e.g. flutter) to load those deferred components. If the compiler is not instructed to do that the code will be eagerly included in the main app. (@rmacnak-google has implemented this, see also go/dart-aot-deferred-loading). As mentioned above, Flutter enables actual deferred components only on Android. So I think this needs a documentation update in https://dart.dev/language/libraries#lazily-loading-a-library |
IMO, conversation on tickets #8659 and #5165 relevant here. Also, looking at Dart (not Flutter) site for [Web apps > Deployment > Make your app smaller... ](https://dart.dev/web/deployment#make-your-app-smaller-faster-and-more-reliable) you'll see As @ditman points out Flutter (web) Gallery, where you can see all the |
Update deferred loading language. Fixes #7117 Fixes #8659 Fixes #5165 Added @johnpryan due to his point on #5165 and @mkustermann due to his feedback on #7117. ---- Direct link: https://flutter-docs-prod--pr10083-fix-7717-yr828aok.web.app/perf/deferred-components
Update deferred loading language. Fixes flutter#7117 Fixes flutter#8659 Fixes flutter#5165 Added @johnpryan due to his point on flutter#5165 and @mkustermann due to his feedback on flutter#7117. ---- Direct link: https://flutter-docs-prod--pr10083-fix-7717-yr828aok.web.app/perf/deferred-components
Update deferred loading language. Fixes flutter#7117 Fixes flutter#8659 Fixes flutter#5165 Added @johnpryan due to his point on flutter#5165 and @mkustermann due to his feedback on flutter#7117. ---- Direct link: https://flutter-docs-prod--pr10083-fix-7717-yr828aok.web.app/perf/deferred-components
Uh oh!
There was an error while loading. Please reload this page.
Page URL
https://docs.flutter.dev/perf/deferred-components
https://dart.dev/language/libraries#lazily-loading-a-library
Page source
No response
Describe the problem
I'm pretty sure that deferred loading is supported in Flutter when running on web and when running on Android.
However, https://docs.flutter.dev/perf/deferred-components states:
And https://dart.dev/language/libraries#lazily-loading-a-library states:
Expected fix
If deferred loading is supported on both platforms, I would expect both notes to say so. If these are separate features (ie, "deferred loading" is different than "different components") than I would expect that to be better documented. Thanks!
Additional context
No response
The text was updated successfully, but these errors were encountered: