skip to Main Content

I am trying to add raw_user_metadata on the auth.users table when a new user creates an account. However, I’m unable to find the documentation for how to do so in Flutter. The documentation exists for the Javascript client library so it seems to be possible, but it isn’t documented for Flutter.

See the "sign up with additional user metatdata" javascript documentation here: https://supabase.com/docs/reference/javascript/auth-signup

In javascript, this is how you add raw_user_metadata:


const { data, error } = await supabase.auth.signUp(
  {
    email: '[email protected]',
    password: 'example-password',
    options: {
      data: {
        first_name: 'John',
        age: 27,
      }
    }
  }
)

How can I accomplish the same thing in Flutter?

2

Answers


  1. You can do it like this:

    final AuthResponse res = await supabase.auth.signUp(
      email: '[email protected]',
      password: 'example-password',
      data: {'username': 'my_user_name'},
    );
    
    Login or Signup to reply.
  2. I found this in the Supabase Flutter related docs itself:

     final AuthResponse res = await supabase.auth.signUp(
        email: '[email protected]',
        password: 'example-password',
     );
     final Session? session = res.session;
     final User? user = res.user;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search