Download_Application_Pdf method

Future<Uint8List?> Download_Application_Pdf()

Implementation

Future<Uint8List?> Download_Application_Pdf() async{
  String jwt_token= await GetCurrentJWTToken();
  print("Calling Download_Application_Pdf Using API"+jwt_token);

  String lead_id = await GetLeadId();
  print("Download_Application_Pdf for Lead ID : "+lead_id);

  String? doc_id = await Get_ESIGN_DOC_ID();
  print("Download_Application_Pdf for Doc Id : "+doc_id!);

  var headers = {
    'Authorization': 'Bearer $jwt_token',
    'Content-Type': 'application/json'
  };

  var request = http.Request('POST', Uri.parse('$BASE_API_LINK_URL/api/eSign/Download_Application_Pdf'));
  request.body = json.encode({
    "lead_Id": "$lead_id"
  });
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    Uint8List byteFormatOfPdf = await response.stream.toBytes();
    print(byteFormatOfPdf);
    return byteFormatOfPdf;
  }
  else {
    print(response.reasonPhrase);
    return null;
  }
}