Clarify AutomaticKeepAliveClientMixin semantics in build method (#145297)

This should help folks who trace the code before reading the documentation.
This commit is contained in:
Ian Hickson 2024-03-21 14:28:07 -07:00 committed by GitHub
parent eaf509aaf8
commit afe01503d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -400,6 +400,10 @@ mixin AutomaticKeepAliveClientMixin<T extends StatefulWidget> on State<T> {
Widget build(BuildContext context) {
if (wantKeepAlive && _keepAliveHandle == null) {
_ensureKeepAlive();
// Whenever wantKeepAlive's value changes (or might change), the
// subclass should call [updateKeepAlive].
// That will ensure that the keepalive is disabled (or enabled)
// without requiring a rebuild.
}
return const _NullWidget();
}