You can translate text in a Flutter app without calling the Google Translate API. For Android and iOS apps that need offline translation, use on-device ML Kit through the community-maintained google_mlkit_translation plugin. For a non-Google engine or centrally managed translation, send text to a service such as LibreTranslate. Flutter’s own internationalization tools are for translating your app interface; they do not translate arbitrary text entered by users.
Choose between on-device translation and a translation service
The right approach depends on your target platforms, offline requirements, acceptable translation quality, and how you want text handled.
As an Amazon Associate I earn from qualifying purchases.
| Decision point | On-device ML Kit | LibreTranslate API |
|---|---|---|
| Network | After language models are downloaded, translation can run without sending text to a remote translation server. Google ML Kit | Requires a reachable self-hosted or managed HTTP service. LibreTranslate |
| Flutter platforms | The Flutter plugin documents Android and iOS, not web. Plugin documentation | Can be called from Flutter platforms that can reach the service, subject to network, deployment, and CORS configuration. |
| Operations | Download and manage language models on the device. Plugin documentation | Run your own service or depend on a managed host. LibreTranslate |
| Language support and quality | Google documents more than 50 languages and describes the feature as intended for casual, simple translation. Quality varies by language pair; non-English pairs use English as an intermediate language. Google ML Kit Supported languages | Check the installed language packages and test your content on the chosen deployment; availability and quality depend on that instance. |
| Text handling | Translation text need not be sent to a remote server for translation. Other app services, such as analytics or crash reporting, have separate data flows. Google ML Kit | Text is submitted to the translation endpoint. Review the selected host’s data practices and terms. API documentation |
| Attribution and restrictions | Follow applicable Google attribution and branding guidance; ML Kit translation is restricted on embedded devices without prior permission. ML Kit terms | Review the project and hosting terms for the deployment you choose. |
Build an offline-capable app with ML Kit
1. Check platform and language requirements
ML Kit on-device translation is a practical fit when you are building for Android or iOS, your language pairs are supported, and casual translation quality is sufficient. Google’s current documentation lists more than 50 languages; check its supported-language table rather than assuming every Flutter locale is available. The table uses language codes such as en, es, fr, ja, and zh. View supported languages
The plugin documentation lists iOS deployment target 15.5 or newer, Xcode 15.3 or newer, and Android minSdkVersion 21, targetSdkVersion 35, and compileSdkVersion 35. These are package-page requirements and may change, so verify them against the current plugin documentation when setting up your project. google_mlkit_translation on pub.dev
#1 Best Overall
2. Add the plugin and map language choices
Add the current google_mlkit_translation dependency from pub.dev. Map the languages selected in your app to the plugin’s supported TranslateLanguage values and corresponding language codes. Do not assume an arbitrary locale tag is accepted just because Flutter can represent it.
This plugin is a community-maintained bridge from Dart to Google’s native iOS and Android ML Kit APIs; it is not sponsored or maintained by Google. Its documented platform support does not include Flutter web. When debugging, account for native project setup as well as Dart code. Plugin documentation
3. Download both language models
Tell users when a language model needs to be prepared. Before translating, check that both the source and target models are downloaded; download missing models and show the user the preparation state. The plugin provides model-manager methods to check, download, and delete models. Account for download failures and users who are offline before setup is complete. Plugin documentation
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Rank #2
4. Translate asynchronously and clean up
Create an OnDeviceTranslator with the selected source and target languages, call translateText, and close the translator when the screen or service no longer needs it. Keep the interface responsive and handle empty input, repeated requests, models that are not ready, and lifecycle changes in your app.
final manager = OnDeviceTranslatorModelManager();
await manager.downloadModel(sourceLanguage.bcpCode);
await manager.downloadModel(targetLanguage.bcpCode);
final translator = OnDeviceTranslator(
sourceLanguage: sourceLanguage,
targetLanguage: targetLanguage,
);
try {
final translated = await translator.translateText(inputText);
// Render translated text in the UI.
} finally {
translator.close();
}
This is a conceptual flow, not a tested, drop-in app. Confirm imports, package version, enum names, model readiness checks, and error handling against the plugin’s current API before using it in a release. Plugin documentation
5. Set expectations about accuracy and data
Google says on-device translation is intended for casual and simple translations. Language-pair quality can vary, and non-English-to-non-English translation uses English as an intermediate language. Test the actual pairs and content your app will handle; do not rely on this route for high-stakes translation without an appropriate evaluation and safeguards. Google ML Kit
On-device processing means the translation text does not need to go to a remote translation server. It does not establish that every part of your app is private: analytics, crash reporting, backups, and other services may handle data separately.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchRank #4
Use LibreTranslate when you need an HTTP translation service
LibreTranslate is open-source machine translation software powered by Argos Translate. It documents both self-hosting and managed hosting. With self-hosting, you control the deployment; with managed hosting, you rely on a third party. The appropriate choice depends on your operations capacity and the deployment’s terms, availability, and data handling. LibreTranslate
Call the documented translation endpoint
LibreTranslate documents a POST /translate endpoint. Its required inputs are text in q, a source language code (or auto), and a target code. Optional fields include format (text or html), alternatives, and api_key. A successful response includes translatedText. Documented errors include 400 for an invalid request, 403 for a banned request, 429 for rate limiting, and 500 for a translation error. API documentation
Best Value
{
"q": "Hello world!",
"source": "en",
"target": "es",
"format": "text"
}
Keep private credentials off the device
If your chosen managed endpoint requires a private API key, do not put that key in the Flutter app: a key shipped to users can be extracted. A common production design is Flutter app → your backend → translation service. A backend can keep credentials server-side and apply rate limits, abuse controls, logging policies, or provider switching. This is an architectural recommendation, not a LibreTranslate requirement.
A direct app-to-endpoint request may be appropriate for a service designed for public access, but first check its authentication rules and network configuration. Before choosing a managed provider, assess language coverage, translation quality for your content, data retention, authentication, request limits, costs, latency, uptime commitments, and fallback options. Those terms vary by provider and deployment.
Know when Flutter localization is the right tool
Flutter internationalization and localization support is for translating the app’s own interface: labels, buttons, messages, and other UI content. Use that when you are preparing a multilingual product interface. It does not, by itself, translate arbitrary user-entered text at runtime; that requires a translation engine such as on-device ML Kit or a translation service. Flutter internationalization documentation
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




