gemini_tts_wrapper 0.1.0 copy "gemini_tts_wrapper: ^0.1.0" to clipboard
gemini_tts_wrapper: ^0.1.0 copied to clipboard

One-shot Gemini TTS REST client for Flutter that returns audio bytes (Uint8List) and includes an in-memory just_audio source.

gemini_tts_wrapper #

style: very good analysis Powered by Mason License: MIT

Client-side (REST) Gemini TTS wrapper for one-shot audio output.

This package calls the Generative Language API :generateContent endpoint with response_mime_type set to an audio type (default: audio/wav) and returns the decoded audio bytes as Uint8List.

It also includes Uint8ListAudioSource to play those bytes directly from memory via just_audio (no temporary file required).

Security Note #

Using a long-lived Gemini API key directly in a client app is not secure. For production, prefer a server-side proxy (Cloud Functions, Cloud Run, etc.) and short-lived tokens or additional auth.

Installation ๐Ÿ’ป #

โ— In order to start using Gemini Tts Wrapper you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

flutter pub add gemini_tts_wrapper

Usage #

Generate one-shot TTS audio bytes:

import 'package:gemini_tts_wrapper/gemini_tts_wrapper.dart';

final tts = GeminiTts(apiKey: 'YOUR_API_KEY');
final bytes = await tts.generate(
  text: 'Merhaba dunya!',
  voice: 'aoide',
  responseMimeType: 'audio/wav',
);

Play in-memory bytes with just_audio:

import 'package:just_audio/just_audio.dart';
import 'package:gemini_tts_wrapper/gemini_tts_wrapper.dart';

final player = AudioPlayer();
await player.setAudioSource(Uint8ListAudioSource(bytes, contentType: 'audio/wav'));
await player.play();

Example App #

Run the included example:

cd example
flutter run

Continuous Integration ๐Ÿค– #

Gemini Tts Wrapper comes with a built-in GitHub Actions workflow powered by Very Good Workflows but you can also add your preferred CI/CD solution.

Out of the box, on each pull request and push, the CI formats, lints, and tests the code. This ensures the code remains consistent and behaves correctly as you add functionality or make changes. The project uses Very Good Analysis for a strict set of analysis options used by our team. Code coverage is enforced using the Very Good Workflows.


Running Tests ๐Ÿงช #

For first time users, install the very_good_cli:

dart pub global activate very_good_cli

To run all unit tests:

very_good test --coverage

To view the generated coverage report you can use lcov.

# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
open coverage/index.html
1
likes
150
points
253
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

One-shot Gemini TTS REST client for Flutter that returns audio bytes (Uint8List) and includes an in-memory just_audio source.

Repository (GitHub)
View/report issues

Topics

#tts #gemini #audio #google #flutter

License

MIT (license)

Dependencies

dio, flutter, just_audio

More

Packages that depend on gemini_tts_wrapper