flutter_text_to_speech 3.0.7 flutter_text_to_speech: ^3.0.7 copied to clipboard
An on-device Flutter Text-to-Speech plugin
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_text_to_speech/flutter_text_to_speech.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
VoiceController controller = FlutterTextToSpeech.instance.voiceController();
controller.init().then((_) {
controller.speak(
"testing audio output", VoiceControllerOptions(delay: 5));
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
),
);
}
}