currentUser function

  1. @Riverpod(keepAlive: true)
User? currentUser(
  1. Ref<Object?> ref
)

Exposes the current authenticated user (null when signed out).

Implementation

@Riverpod(keepAlive: true)
User? currentUser(Ref ref) {
  final authState = ref.watch(authStateProvider);
  return authState.whenOrNull(data: (state) => state.session?.user);
}