4
4

1 回答 1

0

发生这种情况是因为您在构建小部件树时试图导航到其他地方。

您应该将 移动Navigation.push到流侦听器,例如,在您的initState.

void initState() {
super.initState();
collection.snapshots.listen((data){

if(validated == true) {
   await Navigator.push(context, new MaterialPageRoute(
      builder: (BuildContext context) =>
      new Screen(documentInfo: documentInfo)));
  }
});

}
于 2019-02-27T14:39:59.013 回答