Describe the bug
After sending the app to the mobile I get the error (Log)
Step to Reproduce
Tutorial Flutter_firebase_login
start app
link to repository project: https://github.com/WillianNightray/flutter_firebase_login
*Logs *
I/flutter ( 8495): AppStarted
E/flutter ( 8495): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 'package:bloc/src/transition.dart': Failed assertion: line 15 pos 16: 'currentState != null': is not true.
E/flutter ( 8495): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:40:39)
E/flutter ( 8495): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 8495): #2 new Transition (package:bloc/src/transition.dart:15:16)
E/flutter ( 8495): #3 Bloc._bindStateSubject.<anonymous closure> (package:bloc/src/bloc.dart:131:28)
E/flutter ( 8495): #4 Stream.forEach.<anonymous closure>.<anonymous closure> (dart:async/stream.dart:834:45)
E/flutter ( 8495): #5 _runUserCode (dart:async/stream_pipe.dart:11:23)
E/flutter ( 8495): #6 Stream.forEach.<anonymous closure> (dart:async/stream.dart:834:11)
E/flutter ( 8495): #7 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 8495): #8 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 8495): #9 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter ( 8495): #10 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
E/flutter ( 8495): #11 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
E/flutter ( 8495): #12 _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:375:20)
E/flutter ( 8495): #13 _BroadcastStreamController._add (dart:async/broadcast_stream_controller.dart:287:5)
E/flutter ( 8495): #14 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 8495): #15 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 8495): #16 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter ( 8495): #17 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
E/flutter ( 8495): #18 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263:7)
E/flutter ( 8495): #19 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:132:11)
E/flutter ( 8495): #20 _ForwardingStream._handleData (dart:async/stream_pipe.dart:98:10)
E/flutter ( 8495): #21 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:164:13)
E/flutter ( 8495): #22 _rootRunUnary (dart:async/zone.dart:1132:38)
E/flutter ( 8495): #23 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter ( 8495): #24 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter ( 8495): #25 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:336:11)
E/flutter ( 8495): #26 _DelayedData.perform (dart:async/stream_impl.dart:591:14)
E/flutter ( 8495): #27 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:707:11)
E/flutter ( 8495): #28 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:667:7)
E/flutter ( 8495): #29 _rootRun (dart:async/zone.dart:1120:38)
E/flutter ( 8495): #30 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 8495): #31 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 8495): #32 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 8495): #33 _rootRun (dart:async/zone.dart:1124:13)
E/flutter ( 8495): #34 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter ( 8495): #35 _CustomZone.runGuarded (dart:async/zone.dart:923:7)
E/flutter ( 8495): #36 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
E/flutter ( 8495): #37 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter ( 8495): #38 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter ( 8495):
Hi @WillianNightray 馃憢
Thanks for opening an issue.
Can you confirm that you've included your own google-services.json? You need to put your own firebase configuration in the project in order for it to work properly.
Thanks!
yes, I did it.
i enabled google login and email / password functions in firebase
rsrs, sorry my bad.
this line in authentication_bloc --> AuthenticationState get initialState => null; caused the error, i change line to AuthenticationState get initialState => Uninitialized(); and it worked.
but... The sign in with google don't work
Log I/flutter ( 9416): Transition { currentState: LoginState {
I/flutter ( 9416): isEmailValid: true,
I/flutter ( 9416): isPasswordValid: true,
I/flutter ( 9416): isSubmitting: false,
I/flutter ( 9416): isSuccess: false,
I/flutter ( 9416): isFailure: false,
I/flutter ( 9416): }, event: LoginWithGooglePressed, nextState: LoginState {
I/flutter ( 9416): isEmailValid: true,
I think it may be some missing code. I'll be checking.
I have some questions about the code if you can answer me I would appreciate.
Question 1:
why in some cases yield* is used and in others only yield?
Question 2:
What is the function of this line created automatically in some Constructors?
abstract class AuthenticationEvent extends Equatable {
AuthenticationEvent([List props = const []]) : super(props);
}
Question 3:
and if possible explain this constructor? I didn't understand his syntax and his logic very well.
LoginForm({Key key, @required UserRepository userRepository})
: assert(userRepository != null),
_userRepository = userRepository,
super(key: key);
sorry to bother with these questions.
@WillianNightray glad you figured it out! Let me know if you're still having trouble with the google sign in 馃憤
Regarding your other questions:
Equatable. Equatable takes props (properties) and overrides == and hashCode for you. As a result, the AuthenticationEvent class needs to take in an optional list of props. If we don't pass any, then props will automatically be initialized to a const empty list.UserRepository parameter. As soon as the constructor is called, the userRepository that was passed will be evaluated to make sure it isn't null and then it will get assigned to the private _userRepository member variable. super(key: key) is just setting the widget's key if it was provided explicitly.Hope that helps!
Closing for now but feel free to comment with additional questions and I'm happy to continue the conversation 馃憤
Wow, thank you very much.
Now everything is making more sense in my head.
Also, you are doing a great job here.
If I have more problems, I will contact you.
:smile:
Sorry to comment on a closes issue.
I forgot (again) that firebase google login requires that the (optional) SHA certificate fingerprint is added to the android app setup on firebase (this can explain why email/password signin works but google signing doesn't). (Ditto for phone auth, dynamic links etc)
Most helpful comment
Wow, thank you very much.
Now everything is making more sense in my head.
Also, you are doing a great job here.
If I have more problems, I will contact you.
:smile: