flutter_tts 0.1.1

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

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

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.

ChangeLog

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

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.1.1

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.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
0.0.6 May 6, 2018 Go to the documentation of flutter_tts 0.0.6 Download flutter_tts 0.0.6 archive
0.0.5 May 1, 2018 Go to the documentation of flutter_tts 0.0.5 Download flutter_tts 0.0.5 archive
0.0.4 Apr 19, 2018 Go to the documentation of flutter_tts 0.0.4 Download flutter_tts 0.0.4 archive
0.0.3 Apr 17, 2018 Go to the documentation of flutter_tts 0.0.3 Download flutter_tts 0.0.3 archive
0.0.2 Apr 14, 2018 Go to the documentation of flutter_tts 0.0.2 Download flutter_tts 0.0.2 archive
0.0.1 Apr 14, 2018 Go to the documentation of flutter_tts 0.0.1 Download flutter_tts 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs (-10 points)

22 out of 22 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

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
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8