Unverified Commit c05c9f77 authored by chunhtai's avatar chunhtai Committed by GitHub

Makes AutomaticKeepAlive.child non null (#101376)

parent 7f64e2ae
......@@ -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,
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment