


# signInAnonymously method




    *[<Null safety>](https://dart.dev/null-safety)*




[FutureOr](https://api.flutter.dev/flutter/dart-async/FutureOr-class.html)&lt;void> signInAnonymously
()





<p>Sign in anonymously.</p>
<p>Throws a SignInAnonymouslyFailureInterface if an exception occurs.</p>



## Implementation

```dart
FutureOr<void> signInAnonymously() async {
  if (state.status.isSubmissionInProgress) {
    return;
  }

  final form = formRepository.accessForm(formName);
  emit(SignInState(form: form, status: FormStatus.submissionInProgress));

  return CustomRoutine<Account, Data?>(
    routine: authenticationRepository.signInAnonymously,
    attachedLogic: (routineResult) => onSignInAnonymously(
      routineResult,
      form,
    ),
    onError: (error) {
      emit(
        SignInState(
          form: form,
          errorMessage: error.message,
          status: FormStatus.submissionFailure,
        ),
      );
      addError(error);
    },
    onSuccess: (account, data) {
      authenticationRepository.addSession(
        SessionWrapper(
          event: SignedInEvent(account: account),
          session: Session<Data>(
            account: account,
            data: data,
          ),
        ),
      );
      emit(
        SignInState(
          form: form,
          status: FormStatus.submissionSuccess,
        ),
      );
    },
  ).call();
}
```







