downloadAuthenticatedBytes method

Future<Uint8List> downloadAuthenticatedBytes(
  1. String url
)

Download file bytes from a URL that requires authentication.

Sends the same API key and bearer token headers used for JSON requests.

Implementation

Future<Uint8List> downloadAuthenticatedBytes(String url) async {
  final response = await _httpClient.get(
    Uri.parse(url),
    headers: _headers,
  );
  if (response.statusCode != 200) {
    throw FirestackException(
      'Authenticated download failed',
      statusCode: response.statusCode,
    );
  }
  return response.bodyBytes;
}