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
- login With OAuth Failed
login With OAuth Failed: when i cliick to login with any of the following (facebook, gmail or apple) am being redirected out of the app to enter my detail, afte...
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...
- Synchronous Function Execution Timed Out...
Hi Appwrite team 👋 I’m facing a synchronous function execution timeout issue on Appwrite Cloud and would appreciate some guidance. I executed this function u...