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
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...