问题描述
我有一个 on press 方法可以将用户注销。当用户退出时,他无法导航到注册页面,但他可以重新登录。我应该说我不使用流。 这是我的登出 onpressed 方法:
onpressed:()async{
FirebaseAuth.instance.signOut().then((value) => Navigator.pushNamedAndRemoveUntil(context,LoginScreen.route,(route) => false));
},
这是错误:
The method 'call' was called on null.
Receiver: null
Tried calling: call()
When the exception was thrown,this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1 _LoginScreenState._buildSignupBtn.<anonymous closure> (package:project/authenticate/signin.dart:186:26)
#2 GestureRecognizer.invokeCallback (package:Flutter/src/gestures/recognizer.dart:182:24)
#3 TapGestureRecognizer.handleTapUp (package:Flutter/src/gestures/tap.dart:607:11)
#4 BaseTapGestureRecognizer._checkUp (package:Flutter/src/gestures/tap.dart:296:5)
...
Handler: "onTap"
Recognizer: TapGestureRecognizer#37170
debugOwner: GestureDetector
state: ready
won arena
finalPosition: Offset(301.1,574.8)
finalLocalPosition: Offset(222.4,18.8)
button: 1
sent tap down
这就是我可以在登录页面和注册页面之间切换的toogleview:
Widget _buildSignupBtn() {
return GestureDetector(
onTap: () {
widget.toogleView();
},//onTap: () => print('Sign Up Button pressed'),child: RichText(
text: TextSpan(
children: [
TextSpan(
text: 'Don\'t have an Account? ',style: TextStyle(
color: Colors.white,fontSize: 18.0,fontWeight: FontWeight.w400,),TextSpan(
text: 'Sign Up',fontWeight: FontWeight.bold,],);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)