baidu_speech_recognition 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

Flutter Baidu Speech Recognition Plugin #


A speech recognition plugin for flutter using BaiduSDK.See the changelog for more information about the function.

Getting Started #

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

    baidu_speech_recognition: 0.1.4

Basic Usage #

import 'package:baidu_speech_recognition/baidu_speech_recognition.dart';

BaiduSpeechRecognition _speechRecognition = BaiduSpeechRecognition();

// initialize 
_speechRecognition.init().then((value) => print(value));
// start long speech recognition 
 _speechRecognition.startLongSpeech().then((value) => print(value)); 

 // start speech recognition 60s long
 _speechRecognition.start().then((value) => print(value));  

// cancel recognition 
 _speechRecognition.cancel().then((value) => print(value));

The Callback Listener #

You can add a listener :

      .listen((String value) {
        // TODO do somethig with the value

The return value is a JSON String :

  "type": "The recognition result type",
  "value": "The result"

the type have the following value:

readyready to speaking...
startdetect start speaking...
stopstop speaking. and return the last result
cancelcancel the last recognition
finishreturn the last recognition
lfinishlong speech return
endend speaking...
meterreturn volume meter level

For iOS developer #

Go to 百度ASR download SDK for iOS,then copy BDSClientLib and BDSClientResource to the same directory of you flutter project,the file structure like this:

  |--Your FLutter Projcet/

Then open your iOS projcet on Xcode and add the baidu speech SDK library and some resource.

Add BDSClientLib/libBaiduSpeechSDK.a to you project group as "create groups",

Add BDSClientResource/ASR/BDSClientResources to your project group as "create folder references",

Add BDSClientResource/ASR/BDSClientEASRResources to your project group as "create groups".

Add the following framework to your project:

libc++.tbdFor c/c++ func support
libz.1.2.5.tbdFor gzip support
libsqlite3.0.tbdFor sqlite support
libiconv.2.4.0.tbdSome utility

Finally add Microphone Usage privacy to your info.plist file.

Project Setting #

Open you project with xcode and go to Pods, select the baidu_speech_recognition TARGETS, then select the Build Settings Tab, Change Mach-O Type to Static Library.Then go to the Build Phases, make sure all the Headers are Public.

If you have any problem or Error Please make a issue.

For Android developer #

First become a baidu Developer

The Follow the guide to add some permission and file you need

0.1.4 #

  • fix example bug
  • update readme

0.1.2 #

  • add android support

0.0.1 #

  • 60s short speech recognition
  • long speech recognition
  • iOS support


baidu_speech_recognition_example #

Demonstrates how to use the baidu_speech_recognition plugin.

Getting Started #

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

Use this package as a library

1. Depend on it

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

  baidu_speech_recognition: ^0.1.4

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:baidu_speech_recognition/baidu_speech_recognition.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Format lib/baidu_speech_recognition.dart.

Run flutter format to format lib/baidu_speech_recognition.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


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