identifyPossibleLanguages method
Identifies the possible languages of the given text
.
If no language could be determined then undeterminedLanguageCode is returned.
More information: https://developers.google.com/ml-kit/language/identification
Implementation
Future<List<IdentifiedLanguage>> identifyPossibleLanguages(
String text) async {
final result = await _channel
.invokeMethod('nlp#startLanguageIdentifier', <String, dynamic>{
'text': text,
'possibleLanguages': true,
'confidence': confidenceThreshold,
'id': id,
});
final languages = <IdentifiedLanguage>[];
for (final dynamic json in result) {
languages.add(IdentifiedLanguage.fromJson(json));
}
return languages;
}