Skip to content

mfs-abarragan/vosk-flutter

 
 

Repository files navigation

vosk_flutter_plugin

Flutter plugin for Vosk speech recognition.

How to use

Configurations

Add this pro guard rules in ...android/app/proguard-rules.pro If the file does not exist create it.

-keep class com.sun.jna.* { *; }
-keepclassmembers class * extends com.sun.jna.* { public *; }

Add this plugin to pubspec.yaml

vosk_flutter_plugin:

Load and init model

ByteData modelZip = await rootBundle.load('assets/models/vosk-model-small-en-us-0.15.zip');
await VoskFlutterPlugin.initModel(modelZip);

Start recognition

VoskFlutterPlugin.start();

Stop recognition

VoskFlutterPlugin.stop();

Listen to results

StreamBuilder(
  stream: VoskFlutterPlugin.onPartial(),
  builder: (context, snapshot) => Text(snapshot.data.toString()),
),

StreamBuilder(
  stream: VoskFlutterPlugin.onResult(),
  builder: (context, snapshot) => Text(snapshot.data.toString()),
),

StreamBuilder(
  stream: VoskFlutterPlugin.onFinalResult(),
  builder: (context, snapshot) => Text(snapshot.data.toString()),
),

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 57.1%
  • Java 42.9%