我是flutter web的新手。我在我的flutter web應用程式中實作了firebase登錄功能。這個功能在本地運行正常。但當我在自己的服務器上部署該網站時,如果我輸入正確的憑證,它在實時運行時是正確的,但每當我輸入錯誤的密碼時,它就會給我帶來例外,
未捕獲的參考錯誤:我的網站被洗掉了。
未發現參考錯誤。Toastify未被定義
我使用了fluttertoast庫來分發吐司資訊,我不確定是什么導致了這個問題,這個錯誤是與吐司資訊有關還是與Firebase有關。請看所附的錯誤截圖
這個問題是與fluttertoast庫有關還是與Firebase有關?如何解決這個問題,我們是否需要在Firebase中做任何與域名有關的配置?
我正在使用以下代碼來登錄用戶
Future<void> _signInWithEmailPassword() async {
UtilityHelper.showToast(message: "Login clicked")。
_formkey.currentState?.save()。
bool _isValid = _formkey.currentState?.valid() ? 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)。
}
后期 UserModel _user; UserModel get user => _user;
bool get isChangePasswordButtonShown => _authRepo.isUserLoggedInUsingPasssword;/p>
String errorMsg = '';
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 (錯誤) {
print(error)。
errorMsg = UtilityHelper.getErrorMessage(error)。
return false;
}
希望得到任何幫助。
uj5u.com熱心網友回復:
這個問題與flutter toast庫有關,我用它來顯示toast資訊,它在live domain中不作業。
所以用oktoast庫替換了該庫,解決了這個問題
。轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/320024.html
標籤:
