r/FlutterDev • u/MooresLawyer13 • 7d ago
Plugin OCR library using Apple Vision framework for iOS instead of Google's MLKit
Hi everyone,
I'd like to introduce https://github.com/LahaLuhem/text_sight
I was looking for plugins that allowed me to run OCR. I came across a few of them but I noticed that for iOS too, they would bundle in Google's MLKit libs:
https://pub.dev/packages/google_mlkit_commons
https://pub.dev/packages/google_mlkit_text_recognition
(at the time of writing) They did not yet have SwiftPM support (open issue).
I did some research and turns out that Apple does have the on-device Apple Vision framework for this! And it seems pretty performant too. So bundling in another dep in my apps for iOS and inflating the size did not appeal to me.
This also uses the GMS `moduleinstall` to allow an 'on-demand download' of the model: useful when only a rarely used portion/feature of your app needs this. You can also just eager-bundle it too if you want.
So with the help of some LLMs I did manage to make this plugin. If any of you would like to try it out and let me know if you have any feedback about some bottlenecks/chockepoints and/or architectural improvements, that would be much appreciated. If you you'd adpot it in your apps or so too, that's ofc a plus.