elevenlabs_flutter

Last updated:

0 purchases

elevenlabs_flutter Image
elevenlabs_flutter Images
Add to Cart

Description:

elevenlabs flutter

elevenlabs_flutter #
A Flutter package for interacting with the ElevenLabs API. Provides methods for text-to-speech synthesis, managing voices, and more.
This is the first version of the package, ElevenLabs may update their API, the package may break, I will do my best to keep up with it.
Installation #
Add this to your pubspec.yaml file:
dependencies:
elevenlabs_flutter: ^0.1.0
copied to clipboard
or run dart pub add elevenlabs_flutter
Then run dart pub get.
Usage #
Import the package:
import 'package:elevenlabs_flutter/elevenlabs_flutter.dart';
copied to clipboard
Create an instance of ElevenLabsAPI:
final elevenLabs = ElevenLabsAPI();
copied to clipboard
Initialize it with your API key and endpoint:
await elevenLabs.init(
baseUrl: 'https://api.elevenlabs.io',
apiKey: 'YOUR_API_KEY'
);
copied to clipboard
Now you can call methods like:
// List voices
final voices = await elevenLabs.listVoices();

// Synthesize text
final result = await elevenLabs.synthesize(
TextToSpeechRequest(text: 'Hello world!')
);

// Get synthesis history
final history = await elevenLabs.getHistory();
copied to clipboard
See the API documentation for all available methods.
Handling Errors #
Methods can throw custom exceptions, for example:
try {
await api.getVoice('voice_id');
} on NotFoundException catch (e) {
// Handle 404 error
} on UnknownApiException catch (e) {
// Handle unknown error
}
copied to clipboard
See code for full list of exceptions.
Contributing #
Pull requests welcome! Feel free to open an issue for any API methods that need implementing.
License #
BSD 3-clause License - see LICENSE for details.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.