Home > Blockchain >  The method 'signInWithAnonymously' isn't defined for the type 'FirebaseAuth'
The method 'signInWithAnonymously' isn't defined for the type 'FirebaseAuth'

Time:05-23

I'm getting this problem during I was creating sign in anonymously with the help of Firebase.

import 'package:firebase_auth/firebase_auth.dart';

class AuthServices {
  final FirebaseAuth _auth = FirebaseAuth.instance;

  //sign in anonymous

  Future signInAnon() async {
    UserCredential result = await _auth.signInWithAnonymously();
  }
}

CodePudding user response:

You need to use .signInAnonymously()

  Future signInAnon() async {
    UserCredential result = await _auth.signInAnonymously();
  }
  • Related