Skip to content

Commit

Permalink
Merge pull request #8 from ghuyfel/bugfix-init-throws-exception
Browse files Browse the repository at this point in the history
 bugfix-init-throws-exception: Fix for bug where could not initialisa…
  • Loading branch information
ghuyfel authored Sep 11, 2021
2 parents 25a2b0c + b937c38 commit 578821e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.1

* Fix for bug where could not initialisation throws exception.

## 0.1.0

* Removed async on initialisation.
Expand Down
10 changes: 3 additions & 7 deletions lib/src/voices/voices_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<VoicesResponse> 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<VoicesResponse> 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;
}
}

0 comments on commit 578821e

Please sign in to comment.