Makes AutomaticKeepAlive.child non null (#101376)
This commit is contained in:
parent
7f64e2ae02
commit
c05c9f77c0
@ -28,13 +28,13 @@ class AutomaticKeepAlive extends StatefulWidget {
|
||||
/// [KeepAlive] widget appropriately.
|
||||
const AutomaticKeepAlive({
|
||||
Key? key,
|
||||
this.child,
|
||||
required this.child,
|
||||
}) : super(key: key);
|
||||
|
||||
/// The widget below this widget in the tree.
|
||||
///
|
||||
/// {@macro flutter.widgets.ProxyWidget.child}
|
||||
final Widget? child;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<AutomaticKeepAlive> createState() => _AutomaticKeepAliveState();
|
||||
@ -42,7 +42,7 @@ class AutomaticKeepAlive extends StatefulWidget {
|
||||
|
||||
class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
|
||||
Map<Listenable, VoidCallback>? _handles;
|
||||
Widget? _child;
|
||||
late Widget _child;
|
||||
bool _keepingAlive = false;
|
||||
|
||||
@override
|
||||
@ -60,7 +60,7 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
|
||||
void _updateChild() {
|
||||
_child = NotificationListener<KeepAliveNotification>(
|
||||
onNotification: _addClient,
|
||||
child: widget.child!,
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
|
||||
@ -228,10 +228,9 @@ class _AutomaticKeepAliveState extends State<AutomaticKeepAlive> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
assert(_child != null);
|
||||
return KeepAlive(
|
||||
keepAlive: _keepingAlive,
|
||||
child: _child!,
|
||||
child: _child,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user