handleSignUp() async {
if (await authProvider.register(
name: nameController.text,
username: usernameController.text,
email: emailController.text,
password: passwordController.text,
)){
please help me for this to solve thanktyouuu
CodePudding user response:
It is possible your register
will return null, you can directly use
if(await method()==true){...}
I will prefer to create a separate variable for this.
final bool isRegistered = await authProvider.register(
name: nameController.text,
username: usernameController.text,
email: emailController.text,
password: passwordController.text,
) ?? false; // providing false on null case
if(isRegistered) { ....}
CodePudding user response:
if (await authProvider.register(
name: nameController.text,
username: usernameController.text,
email: emailController.text,
password: passwordController.text,
) !=
null) {
print('Registered');
}else{
print('Something went wrong');
}