For automaticKeepAlive
to work, each item that needs to be kept alive must send a specific notification.
A typical way to fire such notification is using AutomaticKeepAliveClientMixin
class Foo extends StatefulWidget {
@override
FooState createState() {
return new FooState();
}
}
class FooState extends State<Foo> with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
return Container(
);
}
@override
bool get wantKeepAlive => true;
}