flutter_tts 0.2.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 96

Text To Speech #

pub package

A flutter text to speech plugin (Swift,Java)

Features #

  • [x] Android & iOS
    • [x] speak
    • [x] stop
    • [x] get languages
    • [x] set language
    • [x] is language available
    • [x] set speech rate
    • [x] set speech volume
    • [x] set speech pitch
  • [x] Android
    • [x] get voices
    • [x] set voice

Usage #

Android #

Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21

iOS #

There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. Flutter#16049

Example

To use this plugin :

  dependencies:
    flutter:
      sdk: flutter
    flutter_tts:
  • instantiate a FlutterTts instance
FlutterTts flutterTts = new FlutterTts();

speak, stop, getLanguages, setLanguage, setSpeechRate, setVolume, setPitch, isLanguageAvailable #

Future _speak() async{
    var result = await flutterTts.speak("Hello World");
    if (result == 1) setState(() => ttsState = TtsState.playing);
}

Future _stop() async{
    var result = await flutterTts.stop();
    if (result == 1) setState(() => ttsState = TtsState.stopped);
}

List<dynamic> languages = await flutterTts.getLanguages;

await flutterTts.setLanguage("en-US");

await flutterTts.setSpeechRate(1.0);

await flutterTts.setVolume(1.0);

await flutterTts.setPitch(1.0);

await flutterTts.isLanguageAvailable("en-US");

Listening for platform calls #

flutterTts.setStartHandler(() {
  setState(() {
    ttsState = TtsState.playing;
  });
});

flutterTts.setCompletionHandler(() {
  setState(() {
    ttsState = TtsState.stopped;
  });
});

flutterTts.setErrorHandler((msg) {
  setState(() {
    ttsState = TtsState.stopped;
  });
});

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

ChangeLog #

0.2.4 #

  • Android: setting minSDK back to 21 and adding instructions to readme
  • Android: Adding fallback for getLanguages and defaultLanguage

0.2.3 #

  • IOS: Audio continues with the Ring/Silent switch set to silent

0.2.2 #

  • Android: Fixing Locale bug

0.2.1 #

  • IOS: Fixing getLanguages bug

0.2.0 #

  • Android: Adding exception catch for samsung devices
  • Android: Using default com.google.android.tts engine
  • Android: Get and Set Voice
  • Android: InitHandler
  • Cleaning up the example

0.1.2 #

  • Support for Android background execution
  • Updating Android build gradle version to 3.2.1

0.1.1 #

  • Fixing TTS bound error in the example
  • Fixing default voice language not found error on Android

0.1.0 #

  • Updating version for improved maintenance score
  • Updating package description for improved maintenance score

0.0.8 #

  • Adding analysis_options.yaml for improved health score
  • Fixing info/errors from flutter analyze

0.0.7 #

  • Updating SDK version in pubspec.yaml
  • Adding package link to README
  • Fixing language string warning received from xcode

0.0.6 #

  • Android: Upgrading Gradle 4.1 to 4.4
  • Android: Setting minSdk version to 21
  • Android: Adding try/catch to getAvailableLanguages & getDefaultVoice methods (Issues with API 21 & 22)

0.0.5 #

  • Adding IOS/Android isLanguageAvailable
  • Rename setRate to setSpeechRate

0.0.4 #

  • Simplify podspec for Cocoapods 1.5.0

0.0.3 #

  • Adding IOS/Android speech pitch and volume

0.0.2 #

  • Flutter formatting and fixing pubspec sdk versioning

0.0.1 #

  • first POC :
    • methods : speak, stop, setRate, setLangauge, getLanguages
    • a globalHandler for completion

example/README.md

Text To Speech #

pub package

A flutter text to speech plugin (Swift,Java)

Features #

  • [x] Android & iOS
    • [x] speak
    • [x] stop
    • [x] get languages
    • [x] set language
    • [x] is language available
    • [x] set speech rate
    • [x] set speech volume
    • [x] set speech pitch
  • [x] Android
    • [x] get voices
    • [x] set voice

Usage #

Example

To use this plugin :

  dependencies:
    flutter:
      sdk: flutter
    flutter_tts:
  • instantiate a FlutterTts instance
FlutterTts flutterTts = new FlutterTts();

speak, stop, getLanguages, setLanguage, setSpeechRate, setVolume, setPitch, isLanguageAvailable #

Future _speak() async{
    var result = await flutterTts.speak("Hello World");
    if (result == 1) setState(() => ttsState = TtsState.playing);
}

Future _stop() async{
    var result = await flutterTts.stop();
    if (result == 1) setState(() => ttsState = TtsState.stopped);
}

List<dynamic> languages = await flutterTts.getLanguages;

await flutterTts.setLanguage("en-US");

await flutterTts.setSpeechRate(1.0);

await flutterTts.setVolume(1.0);

await flutterTts.setPitch(1.0);

await flutterTts.isLanguageAvailable("en-US");

Listening for platform calls #

flutterTts.setStartHandler(() {
  setState(() {
    ttsState = TtsState.playing;
  });
});

flutterTts.setCompletionHandler(() {
  setState(() {
    ttsState = TtsState.stopped;
  });
});

flutterTts.setErrorHandler((msg) {
  setState(() {
    ttsState = TtsState.stopped;
  });
});

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_tts: ^0.2.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_tts/flutter_tts.dart';
  
Version Uploaded Documentation Archive
0.2.4 Feb 26, 2019 Go to the documentation of flutter_tts 0.2.4 Download flutter_tts 0.2.4 archive
0.2.3 Jan 15, 2019 Go to the documentation of flutter_tts 0.2.3 Download flutter_tts 0.2.3 archive
0.2.2 Jan 10, 2019 Go to the documentation of flutter_tts 0.2.2 Download flutter_tts 0.2.2 archive
0.2.1 Jan 10, 2019 Go to the documentation of flutter_tts 0.2.1 Download flutter_tts 0.2.1 archive
0.2.0 Jan 9, 2019 Go to the documentation of flutter_tts 0.2.0 Download flutter_tts 0.2.0 archive
0.1.2 Dec 27, 2018 Go to the documentation of flutter_tts 0.1.2 Download flutter_tts 0.1.2 archive
0.1.1 Oct 29, 2018 Go to the documentation of flutter_tts 0.1.1 Download flutter_tts 0.1.1 archive
0.1.0 Sep 18, 2018 Go to the documentation of flutter_tts 0.1.0 Download flutter_tts 0.1.0 archive
0.0.8 Sep 17, 2018 Go to the documentation of flutter_tts 0.0.8 Download flutter_tts 0.0.8 archive
0.0.7 Aug 22, 2018 Go to the documentation of flutter_tts 0.0.7 Download flutter_tts 0.0.7 archive

All 16 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
92
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
96
Learn more about scoring.

We analyzed this package on Apr 23, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8