getCurrentUser

abstract fun getCurrentUser(): AuthUser?

Gets the currently authenticated user, if any.

This is a synchronous operation that returns immediately with the cached authentication state from Firebase. It does not perform any network operations.

Use Cases

  • Check if user is signed in before showing authenticated content

  • Get user ID for database queries

  • Display user profile information

  • Initialize app state based on auth status

Example

val currentUser = authDataSource.getCurrentUser()
if (currentUser != null) {
// User is signed in, show authenticated content
loadUserData(currentUser.id)
} else {
// User is signed out, show login screen
navigateToLogin()
}

Return

The currently authenticated AuthUser, or null if not signed in.