registerUser method

Future<Response> registerUser({
  1. required String email,
  2. required String phone,
  3. required String password,
  4. required String firstName,
  5. required String lastName,
})

To register new user in whitelabel app user needs to use below API

Implementation

Future<http.Response> registerUser({
  required String email,
  required String phone,
  required String password,
  required String firstName,
  required String lastName,
}) async {
  Uri url = Uri.parse("$_baseUrl/user/register");

  final body = jsonEncode({
    "email": email,
    "phone": phone,
    "password": password,
    "first_name": firstName,
    "last_name": lastName,
    "business": SharedPreference.getBusinessConfig()!.businessId,
  });

  printMessage(body);

  http.Response response =
      await http.Client().post(url, body: body, headers: kPostRequestHeader);

  if (response.statusCode == 200) {
    printMessage("REGISTER USER RESPONSE = ${response.body}");
    return response;
  } else {
    printMessage("REGISTER USER RESPONSE = ${response.statusCode}");
    printMessage("REGISTER USER RESPONSE = ${response.body}");
    return response;
  }
}