Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
How it works
Linux support is based on the use of the dart FFI.
We generate dart bindings to native C functions from declarations in vosk_api.h using ffigen. Then we add the vosk lib binary to the list of libraries bundled with the application and load that binary using our custom CLI tool. And that's all, now we can call native C functions from the dart code.
CLI tool
Plugins CLI tool is responsible for loading the Vosk binaries(currently only for Linux). It has single command(
install
) with options generated from options.dart using build_cli.Helpful resources
Github Actions
workflow_dispatch
trigger to add the possibility of a manual workflow run (for example, if you want to run the workflow after direct push to master)Other minor changes
.pubignore
to ignore heavy files (Vosk models, binaries)Things to discuss
Vosk API header
Initially I've tried to add vosk-api as a submodule of the repository, but there is a bug in
publish
command, so I abandoned that idea and just put thevosk_api.h
to the project by hand. Maybe there is better solution that I don't see.Versioning
I've just bumped the plugin version to
0.3.47
according to the Dart community convention: