postBinary method
Make a POST request and return binary response (for TTS)
Implementation
Future<Uint8List> postBinary(
String endpoint,
Map<String, dynamic> data, {
Map<String, String>? queryParams,
}) async {
try {
final response = await _dio.post(
endpoint,
data: data,
queryParameters: queryParams,
options: Options(responseType: ResponseType.bytes),
);
if (response.statusCode != 200) {
throw ProviderError(
'ElevenLabs API returned status ${response.statusCode}',
);
}
return Uint8List.fromList(response.data as List<int>);
} on DioException catch (e) {
throw DioErrorHandler.handleDioError(e, 'ElevenLabs');
}
}