Closed bedfir closed 1 year ago
Hello, did you find the solution?
In signUpUser
function in AuthMethods
class, replace the current parameter with this required Uint8List? file
.
Then add the following code in the same function:
if (file != null) {
photoUrl = await StorageMethods().uploadImageToStorage('profilePics', file, false);
} else {
photoUrl = 'https://i.stack.imgur.com/l60Hf.png';
}
Let me know if you face any issue/want an explanation of this.
Hi everyone, the _image is null, so the signUpUser cannot be triggered if the user does not enter an image. this leads to an error by the postfix ! operator. _CastError (Null check operator used on a null value).
String res = await AuthMetods().signUpUser( email: _emailController.text, bio: _bioController.text, password: _passwordController.text, username: _usernameController.text, file: _image!, );
If we follow the logic of the application the user will have a default image.
how can we manage this with Firebase ? if the user doesn't enter an image ?