I'm trying to log in anonymously on my firebase, I have added all the needed stuff that shows in the FireBase page, but for some reason when I try to log in anonymously, I get this erro:
I/flutter ( 1656): MissingPluginException(No implementation found for method signInAnonymously on
channel plugins.flutter.io/firebase_auth)
I/flutter ( 1656): Log in error
This is my sign in anonymously code, doesn't show me any errors on my page:
import 'package:firebase_auth/firebase_auth.dart';
//Definir os metodos que vao interagir com firebase
class AuthService {
final FirebaseAuth _auth = FirebaseAuth.instance;
//Logar anonimamente
Future signInAnon() async {
try {
AuthResult result = await _auth.signInAnonymously();
FirebaseUser user = result.user;
return user;
}catch (e) {
print(e.toString());
return null;
}
}
Calling it in main page:
import 'package:flutter/material.dart';
import 'package:homeautomation/services/auth.dart';
class _SignInState extends State<SignIn> {
final AuthService _auth = AuthService();
...
Body:
Child: RaisedButton(
child: Text('Logar Anonimamente'),
onPressed: () async {
dynamic result = await _auth.signInAnon();
if (result == null)
{
print('erro ao logar');
}
else
{
print('Logado');
print(result);
}
},
),
Restarted Android Studio, and I'm getting a different error now:
PlatformException(ERROR_API_NOT_AVAILABLE, API:
InternalFirebaseAuth.FIREBASE_AUTH_API is not available on this device.
Connection failed with: ConnectionResult{statusCode=SERVICE_INVALID,
resolution=null, message=null}, null)
I/flutter ( 2963): erro ao logar
The GeneratedPluginRegistrant files are generated by Flutter build/run tooling. So if you execute flutter build apk or flutter run, it should work. We are working on improving the user experience here, cf. #14560.
I have FirebaseAuth and Sqflite defined. I cant call any functions in those without getting an exception. This happens on both device and simulator. there are no build errors.
Sorry, something went wrong. There may be certain chances that the plugin/package you are using is only implemented for either Android or iOS platform and you are trying to run it for another platform. Check the Readme file for of that plugin/package carefully.
Have you enabled sign in anonymously in your Firebase console
?
If NO, you have to enable it in the Firebase Console
.
If YES, run flutter clean
and your code should be free from errors.
If flutter clean
doesn't work,
Check if the device you are running on has Google Play Services, if it does not. You have to install. it to stop seeing that error.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With