Email verification flutter firebase exception - flutter

Here's my home_view.dart file
Figure 1 Figure 2
I'm getting an exception... And here it is...
Help me to how to do email verification.

Try using addPostFrameCallback
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Navigator.of(context)...
});

Related

How to redirect a user in flutter after verified their email?

Hello I am new in flutter. I tried the firebase email and password authentication in a flutter project. but I face some problem that is when a user confirm their email it doesn't redirect to another new page. can anyone suggest me what to do?
onPressed: () {
if (emailAuthVerified.isUserVerified()) {
EmailVerificationAlert();
}
Navigator.pushNamed(context, WelcomeScreen.routeName);
}
After email verification you would have to reload() your user info/profile since idTokenChanges(), userChanges() & authStateChanges() won't be able to catch these changes.
Here's the reference: https://firebase.flutter.dev/docs/auth/usage

Cannot send SMS in Flutter Web

I am creating a web app in flutter. It is used for entering students' attendance into the database.
What I want to achieve is to send SMS to the parents of absent students. I came upon flutter_sms 2.3.1 and it is supported for Android, iOS and web as per the pub.dev docs but I could not find any reference about sending SMS in flutter web using the same package. Please let me know if there is any way to achieve this task that I want.
Following is the code for sending the SMS but not working in Flutter web.
void _sendSMS(String message, List<String> recipents) async {
String _result = await sendSMS(message: message, recipients: recipents)
.catchError((onError) {
print(onError);
});
print(_result);
}
Twilio API would totally help you sending sms/whatsapp messages from any plaform automatically

Flutter app is crashing although I wrote it in try catch block

I am using Firebase Auth for my app and for login and to handle errors I wrote it in a try-catch block, but when I enter an incorrect password the app just crashes and throws "PlatformException (PlatformException(ERROR_WRONG_PASSWORD, The password is invalid or the user does not have a password., null))" this error.
How can I fix this?
Here is the code, and the same is for registering users.
try {
final newUser = await _auth.signInWithEmailAndPassword(email: email, password: password);
if (newUser != null) {
Navigator.pop(context);
}
} catch (e) {
print(e);
}
If the solution with VSCode's "All Exceptions" didn't work for you...
Keep in mind that the debug version may throw exceptions while the same code in a release version may not.
If you are sure that your code is failing within the try block and you are handling the catch correctly (like OP is), then try running your app with flutter run --release and check to see if it works.
Check this question/answer here for a bit more information: Flutter catching all unhandled exceptions

Reset password inside the app using flutter

The question is about Firebase authentication :
Do you know how to reset password "inside" the app ? I know how to reset it through a link using this function :
firebaseAuth.sendPasswordResetEmail(email: email)
But I do not find a way to do it inside the app with flutter.
Thanks
Here is a snipped for updating user password.
user.updatePassword(newPassword).then(function() {
// Update successful.
}).catch(function(error) {
// An error happened.
});
for more info, read https://firebase.google.com/docs/auth/web/manage-users

Pwa. On deferredPrompt.prompt() DOMException

While trying to install a PWA with this code:
btnAddPwa.addEventListener('click', (e) => {
deferredPrompt.prompt();
})
Is throwing a error message
This is still a problem. Anyone have idea of how to solve this?