getAllVoices method

Future<List> getAllVoices()

Implementation

Future<List<dynamic>> getAllVoices() async {
  try {
    final url = Uri.parse('https://services-stage.haiva.ai/v1/speech/voices');
    final response = await http.get(url);
    print('>>>>>>>>${response}');
    if (response.statusCode == 200) {
      final List<dynamic> voices = json.decode(response.body);
      return voices;
    } else {
      throw Exception('Failed to retrieve voices. Error: ${response.statusCode}');
    }
  } catch (e) {
    print('Error: $e');
    return [];
  }
}