Posts

Showing posts with the label firebase-authentication

flutter get user email

i want to get my flutter login form user id into a text box.i used firebase to make authentication. i wrote a method to get user email. _getUserEmail(){ FutureBuilder<FirebaseUser>( future: FirebaseAuth.instance.currentUser(), builder: (BuildContext context, AsyncSnapshot<FirebaseUser> snapshot) { if (snapshot.connectionState == ConnectionState.done) { return new Text(snapshot.data.email); } else { return new Text('Loading...'); } }, ); } i want to get this user email into my flutter textbox view initial value. This is my flutter textbox. ListTile( leading: Icon(Icons.info), title: TextFormField( decoration: InputDecoration( labelText: 'Enter Your name' ), initialValue: _getUserEmail(), onSaved: (val) => item.name = val, validator: (val) => val == "" ? val : null, ), ),...

Flutter firebase handling exceptions

I am trying to catch the exceptions thrown by Firebase (from failed login) to flutter but I am having zero luck. .catcherror seems to print out the error but an exception is still crashing my code. I have found similar issues in other posts but no answers seem to help me, it's making my code unusable, thank you so much. try { signIn(typedemail, typedpassword).catchError((e) { print(e); print(e.message.toString()+"rrrrr"); print(e.code); print(e.details); }); } on PlatformException catch (e) { print("on worked");//this doesnt work } finally{ print("finally"); } And I get this if I disable breaking on exceptions D/FirebaseApp(11795): Notified 0 auth state listeners. I/flutter (11795): PlatformException(exception, The email address is badly formatted., null) I/flutter (11795): The email address is badly formatted.rrrrr I/flutter (11795): exception I/flutter (11795): null

cloud_furestore and firebase_auth compatiblity issue in Flutter

I am developing a Flutter app. My app works fine with cloud_firestore and firebase_auth packages when I use them separately. However, when I include both of them together in my pubspecs.yaml file, the build fails and the following message is shown: Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.7.4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.18/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.18/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses unchecked or unsafe operati...