i have been trying to login with facebook authentication with is this plugin
but i keep getting this error after given me a token listeners about the user
D/FirebaseAuth(16644): Notifying id token listeners about user ( 7fJCaA1cplgINtOJuvi2AYxd4dG3 ). E/flutter (16644): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: Class 'NoSuchMethodError' has no instance getter 'code'. E/flutter (16644): Receiver: Instance of 'NoSuchMethodError' E/flutter (16644): Tried calling: code E/flutter (16644): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5) E/flutter (16644): #1 LoginState.build.<anonymous closure>.<anonymous closure> (package:FaithMeetsLove/view/login.dart:157:49) E/flutter (16644): <asynchronous suspension> E/flutter (16644): here is my code
class authenticationApi{ Future<bool> signInFacebook() async { try { final result = await facebookLogin.logIn(['email', 'public_profile']); switch (result.status) { case FacebookLoginStatus.loggedIn: final token = result.accessToken.token; final credential = FacebookAuthProvider.credential(token); final user = (await auth.signInWithCredential(credential)).user; return true; break; case FacebookLoginStatus.cancelledByUser: break; case FacebookLoginStatus.error: print(".....Here is Status Error...........${result.errorMessage}"); break; } return true; } catch (error) { print('Error ${error.code}'); return false; } } } then i call it in my login.dart
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) { progress?.dismiss(); await Flushbar( title: 'Ops!', message: 'error ${e.code}', duration: Duration(seconds: 3), ).show(context); } }, child: LoginBtn( icon: FontAwesomeIcons.facebook, ), ), i am having a hard time to locate the error is coming from..
thanks
print('Error ${error.code}');. Why do you think this execption has a field ascode? Doesn't seem like you have any custom exception in your code. Probabalyprint('Error ${error.messgae}');is what you are looking for?