createUserIndividual function

Future<UserIndividual> createUserIndividual(
  1. String fullName,
  2. String emailAddress,
  3. String password,
  4. String contactNumber,
)

Implementation

Future<UserIndividual> createUserIndividual(String fullName,
    String emailAddress, String password, String contactNumber) async {
  HttpOverrides.global = new MyHttpOverrides();
  final response = await http.post(
    //Uri.parse('https://172.30.1.33:45455/api/UserIndividualModels'),
    Uri.parse('https://192.168.1.106:45455/api/Authenticate/UserIndividual'),

    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      'fullName': fullName,
      'emailAddress': emailAddress,
      'password': password,
      'contactNumber': contactNumber
    }),
  );

  if (response.statusCode == 201) {
    // If the server did return a 201 CREATED response,
    // then parse the JSON.
    return UserIndividual.fromJson(jsonDecode(response.body));
  } else {
    // If the server did not return a 201 CREATED response,
    // then throw an exception.
    throw Exception('Failed to create user.');
  }
}