https://github.com/dlutton/flutter_language_id
Flutter Language Identification package
https://github.com/dlutton/flutter_language_id
android dart flutter flutter-plugin google google-ml-kit ios java
Last synced: 2 months ago
JSON representation
Flutter Language Identification package
- Host: GitHub
- URL: https://github.com/dlutton/flutter_language_id
- Owner: dlutton
- License: mit
- Created: 2020-07-11T23:43:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-12T20:19:55.000Z (almost 6 years ago)
- Last Synced: 2023-08-20T21:58:40.534Z (over 2 years ago)
- Topics: android, dart, flutter, flutter-plugin, google, google-ml-kit, ios, java
- Language: Dart
- Homepage:
- Size: 70.3 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Language Identification
[](https://pub.dartlang.org/packages/flutter_language_identification)
A flutter plugin to identify language using [Google's ML Kit](https://developers.google.com/ml-kit/language/identification). (Swift,Java)
## Features
- [x] Android, iOS
- [x] identify language
- [x] identify possible languages
To use this plugin :
### iOS
Google's ML Kit requires a minimum deployment target of 10.0. You can add the line `platform :ios, '10.0'` in your iOS project `Podfile`.
You may also need to update your app's deployment target to 10.0 using Xcode. Otherwise, you may see compilation errors.
### Flutter
- add the dependency to your pubspec.yaml
```yaml
dependencies:
flutter:
sdk: flutter
flutter_language_identification:
```
- instantiate FlutterLanguageIdentification
```dart
FlutterLanguageIdentification languageIdentification = FlutterLanguageIdentification();
```
### identifyLanguage, identifyPossibleLanguages
```dart
Future _identifyLanguage() async{
await languageIdentification.identyLanguage("Hello World");
}
Future _identifyPossibleLanguages() async{
await languageIdentification.identifyPossibleLanguages("Hello World");
}
```
### Listening for platform calls to receive results
```dart
languageIdentification.setSuccessHandler((message) {
setState(() {
print(message);
_result = message;
});
});
languageIdentification.setErrorHandler((message) {
setState(() {
print(message);
});
});
languageIdentification.setFailedHandler((message) {
setState(() {
print(message);
_result = message;
});
});
```