ML Kit for Firebase: Implementing support in Flutter for Image Labeling Cloud API

in #utopian-io6 years ago (edited)

Repository

https://github.com/flutter/plugins

New Features

Pull request: https://github.com/flutter/plugins/pull/695

Implementing the cloud based API in ML Kit for Firebase.

The Flutter implementation of ML Kit for Firebase was only supporting the offline capable features. This pull request added the first cloud API integration to the plugin.

GitHub Account

https://github.com/DennisAlund

ML Kit for firebase:  Image labeling

Background

I spoke at a conference where another speaker did a live coding of "Hot dog/not hot dog". I instantly wanted to try it myself. But I am not a iOS developer and my Android skills are rusty. But I knew that Flutter is known for ease of learning and speed of development, I decided to explore it.

A couple of hours later I already had a basic app up and running with the ML Kit flutter plugin. Only to learn that the on-device recognition wasn't accurate enough for my taste, and the plugin didn't support integration with the cloud API, at the time of writing.

So, next step was to dive deeper into Flutter, to learn how to develop or extend a plugin, so that I could have the functionality that I wanted.

Instead of developing the hot dog/not hot dog app that night, I made my first community contributon to Flutter.

Anatomy of Flutter plugins

Flutter plugins are dart packages that can either be purely Dart code or implementing integration with the specific platform. I.e. implementing support for native APIs that are not part of the Flutter core. The Firebase libraries are examples of this, including the ML Kit Plugin.

Flutter plugins that integrate with the underlying platform are doing so via an asynchronous message channel that bridges between the Flutter system and plugin code written natively for respective platform. This makes the relationship between Flutter and the platform very dynamic and cleanly separated. The asynchronous nature is ensuring that there are no blocking calls that affects the Flutter UI thread.

Architectural overview: platform channels
Image source: https://flutter.io/platform-channels/

The method channel API supports simple parameter values that can be serialized to JSON (scalar values, lists and maps). So we don't pass large chunks of data across that bridge. In the case of the cloud vision API we're actually just passing the path of the image on the native file system, which is later used in the platform specific native plugin code to make an instance of the corresponding class and make the API call.

Sort:  

Thank you for your contribution. It's good to see a contribution to such an important repo. It would be better if you could have explained little more about your PR in the post, like how you approached, what problems you faced etc.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thank you for your review, @codingdefined!

So far this week you've reviewed 8 contributions. Keep up the good work!

Ya, I got a bit short on the words there. Long week and not much left for the creative writing :-) I'll update with a bit of story to it.

Hi @dennisalund!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @dennisalund!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @dennisalund! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the total payout received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64420.25
ETH 3150.23
USDT 1.00
SBD 3.99