The method 'signInWithAnonymously' isn't defined for the type 'FirebaseAuth'

Viewed 114

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();
  }
}
1 Answers

You need to use .signInAnonymously()

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