updateUserProfile method
To update user profile in whitelabel app user needs to use below API
Implementation
Future<http.Response> updateUserProfile({
String? firstName,
String? lastName,
var photo,
}) async {
Uri url = Uri.parse(
"$_baseUrl/user/update/profile/${SharedPreference.getUser()!.id}");
var request = http.MultipartRequest("PUT", url);
request.headers.addAll(kAuthenticatedPostRequestHeader);
if (photo != null) {
request.files.add(await http.MultipartFile.fromPath("photo", photo.path));
} else {
request.fields["photo"] = "";
}
if (firstName != null) {
request.fields["first_name"] = firstName;
}
if (lastName != null) {
request.fields["last_name"] = lastName;
}
var response = await request.send();
var streamResponse = await http.Response.fromStream(response);
final responseData = json.decode(streamResponse.body);
if (response.statusCode == 200) {
printMessage("UPDATE USER PROFILE RESPONSE = $responseData");
return streamResponse;
} else {
printMessage("UPDATE USER PROFILE RESPONSE = ${response.statusCode}");
printMessage("UPDATE USER PROFILE RESPONSE = $responseData");
printMessage("ERROR");
return streamResponse;
}
}