chopper icon indicating copy to clipboard operation
chopper copied to clipboard

How to download a file with chopper?

Open Simouche opened this issue 3 years ago • 1 comments

Can i download a file using chopper? if yes, how? i checked the docs and some issues, but i don't see anyone talking about it.

what i tried:

  @Get(path: "print/{reservationId}")
  Future<Response<File>> downloadInvoice(
    @Path("reservationId") int reservationId,
  );

and

  @Get(path: "print/{reservationId}")
  Future<Response> downloadInvoice(@Path("reservationId") int reservationId);

both return the same exception:

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Unhandled error FormatException: Missing extension byte (at offset 11) occurred 

any help is appreciated.

Simouche avatar Dec 17 '21 21:12 Simouche

Hmm, I think it is easier to just use the HTTP class from Dart / Flutter or the https://pub.dev/packages/flutter_downloader

JEuler avatar Jan 03 '22 20:01 JEuler