1

I am using parse_server_sdk in flutter mobile to signup a user in an app. Ideally, you can call the ParseUser.createUser(username, password, email) function to do this. My question is that I have added columns firstname and lastname to the User class via back4app console so my users have additional fields besides what is provided out of the box. I intend to make these columns required which means they need to be set when a user is created in the app. The problem is I cannot find (or I am unaware of) a function within ParseUser that allows you to include other parameters beyond username, password and email. My current workaround is to:

  • Make the columns not required
  • First create the user in the app
  • Then, immediately turn around and update the user object with values for the added columns
  • Save the user object again in the same flow

It just seems a bit awkward to do it this way. Is there a more straightforward way to do this that I haven't considered?

uneewk
  • 105
  • 1
  • 5

1 Answers1

3

The following code should work:

final user = ParseUser.createUser(username, password, email)
  ..set('firstname', firstname)
  ..set('lastname', lastname);
await user.signUp();
Davi Macêdo
  • 2,954
  • 1
  • 8
  • 11
  • Excellent. I didn't consider cascading on the user object prior to invoking signup. Exactly what I was looking for. Thank you. – uneewk Apr 16 '21 at 01:49