google_mlkit_genai_proofreading 0.1.0
google_mlkit_genai_proofreading: ^0.1.0 copied to clipboard
A Flutter plugin to use Google's ML Kit GenAI Proofreading API to check grammar and spelling.
Google's ML Kit GenAI Proofreading for Flutter #
A Flutter plugin to use Google's ML Kit GenAI Proofreading API to check grammar and spelling.
PLEASE READ THIS before continuing or posting a new issue:
-
Google's ML Kit was build only for mobile platforms: iOS and Android apps. Web or any other platform is not supported, you can request support for those platform to Google in their repo.
-
This plugin is not sponsored or maintained by Google. The authors are developers excited about Machine Learning that wanted to expose Google's native APIs to Flutter.
-
Google's ML Kit APIs are only developed natively for iOS and Android. This plugin uses Flutter Platform Channels as explained here.
Requirements #
Android #
- minSdkVersion: 26
- targetSdkVersion: 35
- compileSdkVersion: 35
Note: This API is currently only available on Android. iOS support may be added in the future.
Usage #
Proofreading #
Create an instance of Proofreader
final proofreader = Proofreader(
inputType: ProofreadingInputType.keyboard,
language: ProofreadingLanguage.english,
);
Check feature status
final status = await proofreader.checkFeatureStatus();
if (status == FeatureStatus.downloadable) {
await proofreader.downloadFeature(
onDownloadCompleted: () {
// Start proofreading
},
);
} else if (status == FeatureStatus.available) {
// Start proofreading
}
Process text
final text = "The praject is compleet but needs too be reviewd";
final results = await proofreader.runInference(text);
for (final result in results) {
print('Corrected: ${result.text} (confidence: ${result.confidence})');
}
Release resources with close()
proofreader.close();
Example app #
Find the example app here.
Contributing #
Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.