login method

Future<void> login(
  1. String email,
  2. String password
)

Implementation

Future<void> login(String email, String password) async {
  debugPrint('Attempting login for email: $email');
  try {
    await _auth.signInWithEmailAndPassword(email: email, password: password);
    debugPrint('Login successful for email: $email');
    // _userId and _lastLoginTime will be set by the authStateChanges listener
  } on FirebaseAuthException catch (e) {
    debugPrint('Login failed for email: $email, Error: ${e.message}');
    rethrow; // Re-throw to be handled by UI
  } catch (e) {
    debugPrint('Login failed for email: $email, Unexpected Error: $e');
    rethrow; // Re-throw to be handled by UI
  }
}