google_mlkit_digital_ink_recognition 0.3.0 copy "google_mlkit_digital_ink_recognition: ^0.3.0" to clipboard
google_mlkit_digital_ink_recognition: ^0.3.0 copied to clipboard

outdated

A Flutter plugin to use Google's ML Kit Digital Ink Recognition to recognize handwritten text on a digital surface in hundreds of languages, as well as classify sketches.

Google's ML Kit Digital Ink Recognition for Flutter #

Pub Version

A Flutter plugin to use Google's ML Kit Digital Ink Recognition to recognize handwritten text on a digital surface in hundreds of languages, as well as classify sketches.

Getting Started #

Before you get started read about the requirements and known issues of this plugin here.

Usage #

Digital Ink Recognition #

Create an instance of DigitalInkRecognizer

String languageCode; // BCP-47 Code from https://developers.google.com/ml-kit/vision/digital-ink-recognition/base-models?hl=en#text
final digitalInkRecognizer = DigitalInkRecognizer(languageCode: languageCode);

Process ink

final p1 = StrokePoint(x: x1, y: y1, t: DateTime.now().millisecondsSinceEpoch); // make sure that `t` is a long
final p2 = StrokePoint(x: x1, y: y1, t: DateTime.now().millisecondsSinceEpoch); // make sure that `t` is a long

Stroke stroke1 = Stroke(); // it contains all of the StrokePoint
stroke1.point = [p1, p2, ...]

Ink ink = Ink(); // it contains all of the Stroke
ink.strokes = [stroke1, stroke2, ...];

final List<RecognitionCandidate> candidates = await digitalInkRecognizer.recognize(ink);

for (final candidate in candidates) {
  final text = candidate.text;
  final score = candidate.score;
}

Make sure you download the language model before processing any Ink.

Release resources with close()

digitalInkRecognizer.close();

Managing remote models #

Create an instance of model manager

final modelManager = DigitalInkRecognizerModelManager();

Check if model is downloaded

final bool response = await modelManager.isModelDownloaded(model);

Download model

final bool response = await modelManager.downloadModel(model);

Delete model

final bool response = await modelManager.deleteModel(model);

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.

17
likes
0
pub points
89%
popularity

Publisher

verified publisherflutter-ml.dev

A Flutter plugin to use Google's ML Kit Digital Ink Recognition to recognize handwritten text on a digital surface in hundreds of languages, as well as classify sketches.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, google_mlkit_commons

More

Packages that depend on google_mlkit_digital_ink_recognition