dynamic result
в этом методе должен возвращать 'null' из метода signInWithEmail, но вместо этого возвращает Future. Следовательно, он не go для оператора if.
Вход в класс
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0),
),
color: Colors.teal,
textColor: Colors.white,
child: Text("Login"),
onPressed: () async {
if(_formKey.currentState.validate()){
dynamic result = _auth.signInWithEmail(email, password);
if(result == null){
setState(() {
error = 'Email and Password does not match';
});
}
}
}
),
Вот метод signInWithEmail. Я попытался напечатать что-то в перехватчике, чтобы убедиться, что он работает, и он должен и должен был вернуть 'null'
метод входа в Firebase.
Future signInWithEmail(String email, String password) async {
try{
AuthResult result = await _auth.signInWithEmailAndPassword(email: email, password: password);
FirebaseUser user = result.user;
return _firebaseUser(user);
} catch(e) {
print(e.toString());
return null;
}
}