SaveMemberAndTestPacakgeData method

Future SaveMemberAndTestPacakgeData({
  1. dynamic MembersArray,
  2. dynamic context,
})

Implementation

Future SaveMemberAndTestPacakgeData({MembersArray, context}) async {
  var decodedResponse;
  final ApiBody = {"data": MembersArray};
  try {
    Map data = ApiBody;
    var body = jsonEncode(data);

    final response = await http.post(
      Uri.parse('${WELLNESS_URL}api/diagnostic/save-selected-member'),
      headers: {
        'Authorization': currentUserToken,
        "Content-Type": "application/json"
      },
      body: body,
    );
    decodedResponse = json.decode(response.body);
    if (decodedResponse['success'] == true) {
      // await showDialog(
      //   barrierDismissible: false,
      //   context: context,
      //   builder: (BuildContext context) {
      //     return PinCodePopUp(
      //       messag: "${decodedResponse['message']}",
      //       image: '${LottiePath}Upload_Successful.json',
      //     );
      //   },
      // );
    } else {
      showDialog(
        barrierDismissible: false,
        context: context,
        builder: (BuildContext context) {
          return PinCodePopUp(
            messag: "${decodedResponse['message']}",
            image: '${LottiePath}Error.json',
          );
        },
      );
    }
  } catch (e) {
    ErrorListner(
        apiname: 'api/diagnostic/save-selected-member',
        responsed: "${decodedResponse}",
        request: "${ApiBody}",
        app_error: '${e}');
  }
}