signInAnonymously static method

Future<User?> signInAnonymously(
  1. BuildContext context, {
  2. dynamic onSignInSuccessful(
    1. User?
    )?,
  3. dynamic onError(
    1. String
    )?,
})

Initiates and Anonymous SignIn and the AuthManager changes the screen to the destinationFragment

Enable Anonymous Authentication in your Firebase Authentication Console for this to work context is neccessary

onSignInSuccessful a Callback to perform any action after a successful SignIn

Implementation

static Future<User?> signInAnonymously(
  BuildContext context, {
  Function(User?)? onSignInSuccessful,
  Function(String)? onError,
}) async {
  return await Provider.of<FireAuthProvider>(
    context,
    listen: false,
  ).signInAnonymously(
    onSignInSuccessful: onSignInSuccessful,
    onError: onError,
  );
}