Reputation: 43
error:
The argument type 'String?' can't be assigned to the parameter type 'String'. (argument_type_not_assignable at [chatter_box] lib\helperServices\auth.dart:27)
code:
UserCredential result = await _firebaseAuth.signInWithCredential(credential);
User? userdetail = result.user;
SharedPreferenceHelper().saveUserEmail(result.user.email);
Upvotes: 0
Views: 48
Reputation: 3548
The error you're facing came from null-safety, the value that you're getting from the validator method can be either null
or either a String
, so you may want to update your code to this example:
SharedPreferenceHelper().saveUserEmail(result.user.email!);
You can learn more about null safety on official documentation:
https://flutter.dev/docs/null-safety
Upvotes: 1