I want to keepAlive
my widgets which are already rendered in ListView
. I was tried with addAutomaticKeepAlives:true
properties which p
As stated by AutomaticKeepAliveClientMixin and Remi's answer,
Subclasses must implement wantKeepAlive, and their build methods must call super.build (the return value will always return null, and should be ignored).
Therefore, change your build method to:
class Foo extends StatefulWidget {
@override
FooState createState() {
return new FooState();
}
}
class FooState extends State with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
);
}
@override
bool get wantKeepAlive => true;
}