create method

Future<User> create({
  1. required String userId,
  2. required String email,
  3. required String password,
  4. String? name,
})

Use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the /account/verfication route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new account session.

Implementation

Future<models.User> create({
  required String userId,
  required String email,
  required String password,
  String? name,
}) async {
  const String apiPath = '/account';

  final Map<String, dynamic> apiParams = {
    'userId': userId,
    'email': email,
    'password': password,
    'name': name,
  };

  final Map<String, String> apiHeaders = {'content-type': 'application/json'};

  final res = await client.call(
    HttpMethod.post,
    path: apiPath,
    params: apiParams,
    headers: apiHeaders,
  );

  return models.User.fromMap(res.data);
}