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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support š I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...