| 12345678910111213141516171819202122232425262728 |
- import 'package:firebase_auth/firebase_auth.dart';
- class AuthenticationServices {
- final FirebaseAuth _auth = FirebaseAuth.instance;
- //Register a user
- Future createNewUser(String name, String email, String password) async {
- try {
- UserCredential result = await _auth.createUserWithEmailAndPassword(
- email: email, password: password);
- User? user = result.user;
- return user;
- } catch (e) {
- print(e.toString());
- }
- }
- //LogIn with user
- Future loginUser(String email, String password) async {
- try {
- UserCredential result = await _auth.signInWithEmailAndPassword(
- email: email, password: password);
- return result.user;
- } catch(e) {
- print(e.toString());
- }
- }
- }
|