【发布时间】:2021-07-31 15:22:20
【问题描述】:
我有一个基于密码条件调用的方法:
void passwordLogic() {
if(equals(password,correctPassword)){
//// I want to switch to another screen here.
Navigator.push(context, MaterialPageRoute(builder: (context) {
return Main();
}));
}
但是“push”之后的上下文会报错:undefined name 'context'。
【问题讨论】: