UpdateMembers method
Future
UpdateMembers({
- dynamic name,
- dynamic age,
- dynamic gender,
- dynamic relation,
- dynamic context,
- dynamic member_id,
Implementation
Future UpdateMembers(
{name, age, gender, relation, context, member_id}) async {
var decodedResponse;
final ApiBody = {
"name": "${name}",
"age": "${age}",
"gender": "${gender}",
"relation": "${relation}",
"member_id": member_id
};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${WELLNESS_URL}api/diagnostic/create-member'),
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json"
},
body: body,
);
decodedResponse = json.decode(response.body);
if (decodedResponse['success'] == true) {
await getcMemberList();
await showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Upload_Successful.json',
);
},
);
} else {
await showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Error.json',
);
},
);
}
} catch (e) {
ErrorListner(
apiname: 'api/diagnostic/create-member',
responsed: "${decodedResponse}",
request: "${ApiBody}",
app_error: '${e}');
}
}