【发布时间】:2021-11-01 04:39:16
【问题描述】:
我是 Flutter Web 的新手。我已经在我的 Flutter Web 应用程序中实现了 firebase 登录功能。此功能在本地正常工作。但是当我在自己的服务器上部署网站时,如果我输入正确的凭据,它可以在现场正常工作,但是每当我输入错误的密码时,它就会给我异常,
Uncaught ReferenceError: Toastify 没有定义
我使用 fluttertoast 库来显示 toast 消息,我不确定是什么导致了问题,这个错误是与 toast 消息相关还是与 firebase 相关。请看附上error的截图
这个问题与fluttertoast库有关还是与firebase有关?如何解决这个问题,我们需要在firebase中做任何与域相关的配置吗?
我正在使用以下代码登录用户
Future<void> _signInWithEmailPassword() async {
UtilityHelper.showToast(message: "Login clicked");
_formkey.currentState?.save();
bool _isValid = _formkey.currentState?.validate() ?? false;
FocusScope.of(context).requestFocus(FocusNode());
if (_isValid) {
setState(() {
_loginType = LoginType.normal;
_isLoading = true;
});
final authProvider = Provider.of<AuthProvider>(context, listen: false);
final hasResponse = await authProvider.singInUser(loginReqModel);
redirectToHome(hasResponse, authProvider);
}
}
后期用户模型_user; UserModel 获取用户 => _user;
bool 获取 isChangePasswordButtonShown => _authRepo.isUserLoggedInUsingPassword;
字符串错误消息 = '';
Future<bool> singInUser(LoginReqModel reqModel) async {
try {
final response = await _authRepo.singInUser(reqModel);
if (response != null) {
_user = response;
notifyListeners();
return true;
}
notifyListeners();
return false;
} catch (error) {
print(error);
errorMsg = UtilityHelper.getErrorMessage(error);
return false;
}
}
任何帮助将不胜感激。
【问题讨论】:
标签: firebase dart exception flutter-web