diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e731ab..b47d1e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.1 + +* Fix for bug where could not initialisation throws exception. + ## 0.1.0 * Removed async on initialisation. diff --git a/lib/src/voices/voices_handler.dart b/lib/src/voices/voices_handler.dart index 6708ed9..22b967b 100644 --- a/lib/src/voices/voices_handler.dart +++ b/lib/src/voices/voices_handler.dart @@ -7,17 +7,13 @@ import 'package:flutter_azure_tts/src/voices/voices_response_mapper.dart'; import 'package:http/http.dart' as http; class VoicesHandler { - late final VoicesClient _client; - - VoicesHandler() { + Future getVoices() async { final client = http.Client(); final header = BearerAuthenticationHeader(token: Config.authToken!.token); - _client = VoicesClient(client: client, header: header); - } + final voiceClient = VoicesClient(client: client, header: header); - Future getVoices() async { final mapper = VoicesResponseMapper(); - final response = await _client.get(Uri.parse(Endpoints.voicesList)); + final response = await voiceClient.get(Uri.parse(Endpoints.voicesList)); return mapper.map(response) as VoicesResponse; } }