1

I am trying to login with Twitter when i used dependency firebase_auth:^0.6.6 it was working perfactly and i fetch the user's Profile picture and the Code was

final TwitterLoginResult result = await twitterLogin.authorize();
switch (result.status)
{
case TwitterLoginStatus.loggedIn:
var session = result.session;
FirebaseUser user = await _auth.signInWithTwitter(
authToken: session.token, authTokenSecret: session.secret); 
img=user.photoUrl;
}

but i migrated the app to AndroidX and this dependency was not compatible so i used firebase_auth: ^0.14.0+5 and this code was not working so i change the code to

final TwitterLoginResult result = await twitterLogin.authorize();

switch (result.status) {
case TwitterLoginStatus.loggedIn:
var session = result.session;

final AuthCredential credential =
TwitterAuthProvider.getCredential(authToken: session.token,
authTokenSecret: session.secret);

FirebaseUser user = (await _auth.signInWithCredential(credential)).user;

and this code is not working app is Crashing and showing the error

W/BiChannelGoogleApi(18829): [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzak@70a4ccf
W/InputMethodManager(18829): startInputReason = 1
D/FirebaseAuth(18829): Notifying id token listeners about user ( D71yiiEX7ubSon4xxcddKlSydn72 ).
D/FirebaseAuth(18829): Notifying auth state listeners about user ( D71yiiEXccccccccKlSydn72 ).
I/zygote64(18829): Do full code cache collection, code=124KB, data=91KB
I/zygote64(18829): After code cache collection, code=123KB, data=68KB
I/zygote64(18829): Do partial code cache collection, code=123KB, data=68KB
I/zygote64(18829): After code cache collection, code=123KB, data=68KB
I/zygote64(18829): Increasing code cache capacity to 512KB
D/AndroidRuntime(18829): Shutting down VM
E/AndroidRuntime(18829): FATAL EXCEPTION: main
E/AndroidRuntime(18829): Process: com.example.login_app, PID: 18829
E/AndroidRuntime(18829): java.lang.IllegalArgumentException: Unsupported value: null
E/AndroidRuntime(18829):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:294)
E/AndroidRuntime(18829):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829):    at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:291)
E/AndroidRuntime(18829):    at io.flutter.plugin.common.StandardMethodCodec.encodeSuccessEnvelope(StandardMethodCodec.java:57)
E/AndroidRuntime(18829):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime(18829):    at io.flutter.plugins.firebaseauth.FirebaseAuthPlugin$SignInCompleteListener.onComplete(FirebaseAuthPlugin.java:691)
E/AndroidRuntime(18829):    at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
E/AndroidRuntime(18829):    at android.os.Handler.handleCallback(Handler.java:808)
E/AndroidRuntime(18829):    at android.os.Handler.dispatchMessage(Handler.java:101)
E/AndroidRuntime(18829):    at android.os.Looper.loop(Looper.java:166)
E/AndroidRuntime(18829):    at android.app.ActivityThread.main(ActivityThread.java:7529)
E/AndroidRuntime(18829):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(18829):    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
E/AndroidRuntime(18829):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
I/Process (18829): Sending signal. PID: 18829 SIG: 9
Lost connection to device.

Please can someone explain to me how to resolve this problem?

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
Sanwal Ijaz
  • 154
  • 11

1 Answers1

2

Problem is with login task AND Androidx twitter_login_issue

Add this dependency in your pubspec.yaml file and let me know this working or not?

flutter_twitter_login: 
  git: git://github.com/eudangeld/flutter_twitter_login.git

Same issue (question) login_issue

Aamil Silawat
  • 6,696
  • 3
  • 17
  • 34
  • @SanwalIjaz you tried this version of firebase_auth: firebase_auth: ^0.15.2 – Aamil Silawat Jan 16 '20 at 14:04
  • Yes ,but its not compatible,it shows : "The current Flutter SDK version is 1.9.1+hotfix.2. Because your_app depends on firebase_auth >=0.15.1+1 which requires Flutter SDK version >=1.10.0 <2.0.0, version solving failed." – Sanwal Ijaz Jan 16 '20 at 14:32
  • @SanwalIjaz upgrade your SDK like this environment: sdk: ">=2.2.0 <3.0.0" I hope it will works – Aamil Silawat Jan 17 '20 at 05:15