getPreview method

Stream<List<int>> getPreview(
  1. String id
)

Implementation

Stream<List<int>> getPreview(String id) async* {
  final url = Uri.parse('${baseUrl}api/files/previews/$id');
  final streamedResponse = await client.send(http.Request('GET', url));

  if (streamedResponse.statusCode != 200) {
    final response = await http.Response.fromStream(streamedResponse);
    throw MailosaurError(response);
  }

  yield* streamedResponse.stream;
}