editDoctorProfile method
Implementation
Future<String?> editDoctorProfile(Map details) async {
/// values expected (as spelt) in details map are [ "firstName": "Immanuel", "middleName": "", "lastName": "Kolapo", "dateOfBirth": null, "sex": "Male", "address": "", "city": "", "state": "", "selfie": null, "identityType": "", "identityNumber": "", "identityVerified": false, "weight": null, "height": null, "genotype": "", "medicalDocuments": null, "emergencyContacts": null, ]
dynamic returnable;
await SharedPreferences.getInstance().then((pref) async {
String? token = pref.getString("token");
String? client_id = iAmA == "consultant"
? Params.consultant_client_id
: Params.patient_client_id;
Map data = details;
/*Calling the API url */
var jsonData;
final response = await http.patch(
Uri.parse(Params.base_url + "/accounts/doctor/profile"),
body: data,
headers: {"Client-ID": "$client_id", "Authorization": "$token"});
if (debug) {
print('Status Code = ' +
response.statusCode.toString() +
". Response: " +
response.body);
}
/*If the response is 200 or 201 (success) then the response will be decoded */
if (response.statusCode == 200 || response.statusCode == 201) {
jsonData = json.decode(response.body);
returnable = jsonData["message"];
} else {
if (debug) print("Error Requesting API");
returnable = null;
}
});
return returnable;
}