unicreators / mvvm

A Flutter MVVM (Model-View-ViewModel) implementation. It uses property-based data binding to establish a connection between the ViewModel and the View, and drives the View changes through the ViewModel.
https://pub.dev/packages/mvvm
MIT License
134 stars 22 forks source link

请问View如何重建视图 #12

Closed kamike closed 4 years ago

kamike commented 4 years ago

在实际项目中,首页下面有几个table,用PageView切换,作为PageView的item,需要销毁和重建视图,需要重写这个方法 @override MineState createState() => MineState();

否则报错 The createState function for MineView returned an old or invalid state instance: MineView, which is not null, violating the contract for createState. 'package:flutter/src/widgets/framework.dart': Failed assertion: line 4609 pos 7: '_state._widget == null'

如何解决呢,在view里面重写createState返回一个新的视图?