register method

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

Implementation

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