saveDocument method

Future<Map> saveDocument(
  1. Uint8List? responseBytes,
  2. String number,
  3. DocumentTypes type
)

Implementation

Future<Map> saveDocument(Uint8List? responseBytes, String number, DocumentTypes type) async {
  if(responseBytes != null){
    if(type == DocumentTypes.pdf){
      return await downloadFile(responseBytes, number, 'pdf');
      //await Printing.layoutPdf(onLayout: (PdfPageFormat format) async => responseBytes);
    } else if (type == DocumentTypes.xml){
      return await downloadFile(responseBytes, number, 'xml');
    }
  }
  return {'type': '', 'message': 'empty'};
}