getObject method

Future<Uint8List> getObject(
  1. String url
)

Implementation

Future<Uint8List> getObject(String url) async {
  final response = await _dio.get(
    url,
    options: Options(responseType: ResponseType.stream),
  );
  final body = response.data;
  final imageBytes = BytesBuilder();
  await body.stream.forEach(imageBytes.add);
  return imageBytes.toBytes();
}