官方推荐方法:
AutomaticKeepAliveClientMixin,同时实现wantKeepAlive方法。 class _MsgLisViewState extends State<MsgListView> with AutomaticKeepAliveClientMixin { ...
@override bool get wantKeepAlive => true; // 需要实现这个方法,返回true则会保持状态 ... }
作者:yuanzhiying
PageView/TabBarView 等控件保存状态的问题解决方案
原文:https://www.cnblogs.com/jiuyi/p/12628539.html