使用AutomaticKeepAliveClientMixin
警告⚠️ This method overrides a method annotated as @mustCallSuper in 'AutomaticKeepAliveClientMixin', but doesn't invoke the overridden method.
该方法将覆盖在’AutomaticKeepAliveClientMixin’中标注为@mustCallSuper的方法,但不会调用覆盖的方法。
解决方案:
检查 添加AutomaticKeepAliveClientMixin
添加
1
2<br>
bool get wantKeepAlive => true;build方法中记得调用父类方法
super.build(context);
1
2
3
4Widget build(BuildContext context) {
super.build(context);
return Container();
}