isAuthenticated function

  1. @riverpod
bool isAuthenticated(
  1. Ref ref
)

Is authenticated provider

Implementation

@riverpod
bool isAuthenticated(Ref ref) {
  final authState = ref.watch(authProvider);

  return authState.when(
    data: (state) => state.maybeWhen(
      authenticated: (_, __) => true,
      orElse: () => false,
    ),
    loading: () => false,
    error: (_, __) => false,
  );
}