import 'package:firebase_auth/firebase_auth.dart'; class AuthService { // instance of auth final FirebaseAuth _auth = FirebaseAuth.instance; //sign in Future signInWithEmailPassword(String email, password) async { try { UserCredential userCredential = await _auth.signInWithEmailAndPassword( email: email, password: password, ); return userCredential; } on FirebaseAuthException catch (e) { throw Exception(e.code); } } // sign up (register) Future signUpWithEmailPassword(String email, password) async { try { UserCredential userCredential = await _auth.createUserWithEmailAndPassword( email: email, password: password, ); return userCredential; } on FirebaseAuthException catch (e) { throw Exception(e.code); } } // sign out Future signOut() async { return await _auth.signOut(); } // errors }