downloadMedia method

  1. @override
Future<DownloadFileResponse> downloadMedia(
  1. String inputPath
)
override

Returns a DownloadFileResponse for a path inputPath

On success DownloadFileResponse.bytes has the corresponding byte list and a null error

In case of error the error field has the corresponding ResponseError structure and a null DownloadFileResponse.bytes

Implementation

@override
Future<DownloadFileResponse> downloadMedia(String inputPath) {
  return catchDioError<DownloadFileResponse>(
      client
          .get<List<int>>(inputPath,
              options: Options(responseType: ResponseType.bytes))
          .then((response) => DownloadFileResponse(bytes: response.data)),
      (de) => DownloadFileResponse(
          error: toResponseError(de, target: inputPath)));
}