flutter_text_to_speech 3.0.2 flutter_text_to_speech: ^3.0.2 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");
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
),
);
}
}