i am trying to login with facebook and i keep getting null, and it will give uid but rest will be null
here is the error.
D/FirebaseAuth(30710): Notifying id token listeners about user ( p8rut85TnGdolVI5Oig0IBRSbqj1 ).
I/flutter (30710): ...........this is the error NoSuchMethodError: The method '[]' was called on null.
I/flutter (30710): Receiver: null
I/flutter (30710): Tried calling: []("id")
here is my code
the on click
GestureDetector(
onTap: ()async {
final progress = ProgressHUD.of(context);
progress?.showWithText('Loging in...');
try {
final facebook = await AuthenticationApi().signInFacebook();
if(facebook){
await checkDataFromDB();
progress?.dismiss();
}else{
progress?.dismiss();
await Flushbar(
title: 'Ops!',
message: 'Sign in not completed, Try again!!!',
duration: Duration(seconds: 3),
).show(context);
}
} on PlatformException catch (err){
progress?.dismiss();
await Flushbar(
title: 'Ops!',
message: 'error ${err.code}',
duration: Duration(seconds: 3),
).show(context);
} catch (e) {
print('...........this is the error $e');
progress?.dismiss();
await Flushbar(
title: 'Ops!',
message: 'error $e',
duration: Duration(seconds: 3),
).show(context);
}
},
child: LoginBtn(
icon: FontAwesomeIcons.facebook,
),
),
here is the class
Future<bool> signInFacebook() async {
var result =
await facebookLogin.logIn(['email', 'public_profile']);
if (result.status == FacebookLoginStatus.loggedIn) {
FacebookAccessToken myToken = result.accessToken;
AuthCredential credential =
FacebookAuthProvider.credential(myToken.token);
var user = await FirebaseAuth.instance.signInWithCredential(credential);
return true;
}
}
here the output in firebase console
thanks for helping