getPrescription method

Future getPrescription(
  1. int consultationID,
  2. String savePath
)

Implementation

Future getPrescription(int consultationID, String savePath) async {
  final response = await callApi(
      endpoint: 'consultations/$consultationID/download-prescription',
      method: 'get');

  if (response.statusCode == 200) {
    final file = await File(savePath).writeAsBytes(response.bodyBytes);
    return file.path;
  } else {
    throw Exception(response);
  }
}