Hey @dammy, could you create a gist with your full code? Happy to take a look and try to figure out a solution!
based off of this, your createAcc() and addPhoneDetails() methods don't have a return type.
This isn't the best way to do this because:
in createAcc, you're returning the response, and if there's an error, you're returning a string. Those are two different types of Future:
submitDetails.then((response) {
if (response.statusCode == 201) {
debugPrint("successful");
}
return response;
}).catchError((error) {
return "An error occured";
});
How to resolve this? Try adding a return type of Future to the createAcc function. This will make sure that whatever gets, returned by the function, is of the type Future<something>. Then you can use await createAcc();. This should work because the function will wait for something to be returned; and that's when you use Future - when the returned value is computed/fetched after some time.
Do the same for the addPhoneDetails(), and see if it works. Let me know if there's any issues!
okay, but originally, submitDetails works, just addPhoneDetails() that is not adding phone number
Btw, response doesn't have a statusCode. I'm surprised your IDE isn't telling you that's a problem
Anyways, again, this comes down to futures and async programming. This is the same problem you're having: https://dart.dev/codelabs/async-await#example-incorrectly-using-an-asynchronous-function
account.create() is not finishing fully before you can account.updatePhone
I did this
Good. And?
account.create() is not finishing fully before you can account.updatePhone
I will check for this again
same issue
What's the full error you're seeing now?
the thing is, it is not adding phone number
Oh right....again you don't have a session. You need to create a session
ouch, no wonder
you mean login?
so, you mean during registration, phone can not be added?
here it is
because, I want to do email and phone verification in parallel
As part of the API, create account does not have a phone parameter.
that means I will request for phone after login?
or is it advisable to alter the sdk file?
not a good practice, and not recommended. You can register the user, then redirect them to add a phone number immediately after
ok then
Thanks man
no worries at all
I appreciate you all @safwan and @Steven
you all are the best, thanks for been of great help
Recommended threads
- Error With iOS Apps
I keep getting the below errors for my flutter app. The clients are registered and have been. This wasn't an issue a few hours ago. AppwriteException: AppwriteE...
- Appwrite Auth & Function don't reveal cl...
When I execute a function or sign in with my Flutter app, Appwrite does not show my real IP: instead, it seems that Appwrite shows Fastly CDN IP address.
- Why does this happen?
`AppwriteException: general_argument_invalid, Invalid `secret` param: Value must be a valid string and at least 1 chars and no longer than 256 chars (400)` the...