Skip to content

"Future already completed" when using AsyncValue.guard in AsyncNotifier #2502

Answered by nazrinharris
hibix43 asked this question in Q&A
Discussion options

You must be logged in to vote

Unsure if this is related, but I've also ran into the same issue. It happened with this code:

@riverpod
class LocalLoginWithEmailAndPassword extends _$LocalLoginWithEmailAndPassword {
  @override
  FutureOr<Option<PecuniaUser>> build() {
    return const Option.none();
  }

  Future<void> localLoginWithEmailAndPassword({
    required String email,
    required String password,
  }) async {
    state = const AsyncValue.loading();

    final failureOrPecuniaUserAndSession = await ref
        .read(authRepoProvider)
        .localLoginWithEmailAndPassword(
          email: email,
          password: password,
        )
        .run();

    return failureOrPecuniaUserAndSession.fold(
      (f…

Replies: 6 comments 10 replies

Comment options

You must be logged in to vote
1 reply
@hibix43
Comment options

Comment options

You must be logged in to vote
1 reply
@hibix43
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@mfrischbutter
Comment options

@maroafenogho
Comment options

@hibix43
Comment options

@AhmedLSayed9
Comment options

@AhmedLSayed9
Comment options

Answer selected by hibix43
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@JakobProssinger
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants