bizz84 / bizz84/coding-with-flutter-login-demo

auth.dart and login.dart error

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
167
Forks
100
PR merge metrics
No merged PRs in 30d

Description

when i cloned the project and run so error comes in auth.dart and in login page . how can i fix this.

error in auth.dart is "A value of type 'AuthResult' can't be assigned to a variable of type 'FirebaseUser'.
code is given below

class Auth implements BaseAuth {
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;

Future signIn(String email, String password) async {
FirebaseUser user = await _firebaseAuth.signInWithEmailAndPassword(email: email, password: password);
return user.uid;
}
Future createUser(String email, String password) async {
FirebaseUser user = await _firebaseAuth.createUserWithEmailAndPassword(email: email, password: password);
return user.uid;
}

and error in login The method 'signInWithEmailAndPassword' isn't defined for the class 'BaseAuth'.
code is given below

Future validateAndSubmit() async {
if (validateAndSave()) {
try {
final BaseAuth auth = AuthProvider.of(context).auth;
if (_formType == FormType.login) {
final String userId = await auth.signInWithEmailAndPassword(_email, _password);
print('Signed in: $userId');
} else {
final String userId = await auth.createUserWithEmailAndPassword(_email, _password);
print('Registered user: $userId');
}
widget.onSignedIn();
} catch (e) {
print('Error: $e');
}
}
}

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading auth.dart and the login page together, then compare the FirebaseAuth calls with the BaseAuth method declarations and the types shown in the errors. Check the project's Firebase API version and verify that both files use matching method names and return types; done means the project builds without these authentication errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, firebase, flutter
Domain
authentication, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.