Today’s article I am going to discuss about HMS ML Kit integration in Flutter.
Let’s know about HMS ML Kit.
HMS ML Kit allows your apps to easily leverage Huawei’s long-term proven expertise in machine learning to support diverse artificial intelligence (AI) applications throughout a wide range of industries. ML Plugin provides diversified leading machine learning capabilities that are easy to use, helping to develop various AI apps.
To integrate HMS Location Kit in Flutter we need Flutter ML Plugin. The plugin enables communication between the ML SDK and Flutter platform. This plugin exposes all capabilities provided by the ML SDK.
Let’s discuss integration steps here.
- Create project in App Gallery Connect and provide relevant information such as app name, Data Storage, SHA 256 Key, package name etc. Enable ML Kit in Manage API Section. Download agconnect-services.json file.
- Add “agconnect-services.json” file under “app” directory.
- Open project level “build.gradle” file.
Add the maven repositories under “buildscript” and “allprojects” section. Add the classpath in dependency section.
4. Open the build.gradle file in the android/app directory of your Flutter project.
Add the AppGallery Connect plugin configuration.
5. Download the Flutter ML Plugin and decompress it.
Add downloaded file into parent directory of the project.
6. Open the pubspec.yaml.
Declare plugin path in pubspec.yaml file under dependencies.
Click pub get to pull the dependency.
7. Open the dart file under lib folder.
Today’s sample I am going to showcase the given two ML Language APIs.
The real-time translation service can translate text from the source language into the target language through the server on the cloud. Currently, real-time translation supports 40 languages
2) Language Detection
The real-time language detection service can detect the language of text. The on-device language detection service can detect the language of text without Internet connection. Both single-language text and multi-language text are supported.
Let’s start the coding.