Skip to content
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

Updated deferred language #5489

Merged
merged 3 commits into from
Mar 22, 2024
Merged

Updated deferred language #5489

merged 3 commits into from
Mar 22, 2024

Conversation

atsansone
Copy link
Contributor

Fixes #5100

@atsansone atsansone added the review.copy Awaiting Copy Review label Jan 26, 2024

To lazily load a library, you must first
import it using `deferred as`.
To lazily load a library, import it using `deferred as`.
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK the flutter-AOT deferred loading solution will still bundle the deferred components in e.g. the Android APK. So they will not lazily be downloaded from network.

This is quite different from JS, where the actual JS files will be downloaded when needed.

It may be worth pointing out this aspect.

@dart-github-bot
Copy link
Collaborator

dart-github-bot commented Jan 26, 2024

Visit the preview URL for this PR (updated for commit bb736ed):

https://dart-dev--pr5489-fix-5100-d6caymz5.web.app

@atsansone atsansone force-pushed the fix-5100 branch 2 times, most recently from 235e444 to db78058 Compare February 9, 2024 05:38
@parlough parlough self-requested a review February 11, 2024 22:32
@parlough parlough self-assigned this Feb 11, 2024
Copy link
Member

@parlough parlough left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this update Tony! However, since this is currently Flutter specific, it's best to just point to the documentation there.

To account for the VM technically having some of the underlying support, we can shift the discussion of lack of support from the "Dart VM" to the dart tool.

@@ -89,29 +89,24 @@ import 'package:lib1/lib1.dart' show foo;
import 'package:lib2/lib2.dart' hide foo;
```

<a id="deferred-loading"></a>
Copy link
Member

Choose a reason for hiding this comment

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

Can you keep this extra anchor fragment target? It's been used for a while and there are a few links from other sites to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't. I checked first. There are two. I believe this PR accounts for that.

@@ -89,29 +89,24 @@ import 'package:lib1/lib1.dart' show foo;
import 'package:lib2/lib2.dart' hide foo;
```

<a id="deferred-loading"></a>
#### Lazily loading a library
#### Lazily loading a library {:#lazily-loading-a-library}
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't expect the header ID customization {:#lazily-loading-a-library} is needed in this case since it matches the original header. Any reason you needed to add it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In case the title ever gets changed because a lot of pages point to this anchor.

Comment on lines 104 to 105
The Android and JavaScript deferred loading differ.
The Android app bundles all deferred components into the APK at compile time.
Copy link
Member

@parlough parlough Feb 19, 2024

Choose a reason for hiding this comment

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

My understanding is that this support for deferred loading on Android functionality is specific to Flutter, and other Dart users can't take advantage it without further customizations to the VM or their embedder.

Due to this and the fact we don't generally document Flutter specific handling on the site, I'd instead recommend not mentioning Android in this discussion, and linking to the Flutter site.

Maybe something roughly like:

The `dart` tool doesn't support deferred loading for its other compilation targets.
If you're building a Flutter app, to learn about the platform it supports for deferred loading,
check out the flutter.dev docs on
[deferred components](https://docs.flutter.dev/perf/deferred-components).

That also prevents us from having to make further updates if Flutter changes that functionality or implements support for other target platforms.

@parlough parlough added review.await-update Awaiting Updates after Edits and removed review.copy Awaiting Copy Review labels Feb 19, 2024
@parlough parlough assigned atsansone and unassigned parlough Feb 19, 2024
@atsansone atsansone added st.RFM Ready to merge or land and removed review.await-update Awaiting Updates after Edits labels Mar 22, 2024
@atsansone atsansone merged commit dd2ac46 into dart-lang:main Mar 22, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
st.RFM Ready to merge or land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify library documentation around support for deferred loading in AOT mode
4 participants