fetchBytes method

Future<List<int>> fetchBytes(
  1. String url
)

Implementation

Future<List<int>> fetchBytes(String url) async {
  final response = await http.get(Uri.parse(url), headers: {
    'Cache-Control': 'no-cache',
    'Pragma': 'no-cache',
  });

  if (response.statusCode == 200) {
    return response.bodyBytes;
  } else {
    throw ServerException('Failed to load image from $url');
  }
}