wordHint abstract method
Returns the hint information of sentence specified in the argument.
For fromLanguage, specify the language of the hint information,
and for learningLanguage, specify the language of the word
or sentence specified in sentence.
A call to this method will always cause a communication process with the Duolingo API. If you want to reuse the cached response object, use cachedWordHint.
Example:
void main() async {
final duolingo = Duolingo.instance;
final authResponse = await duolingo.authenticate(
username: 'test_username',
password: 'test_password',
);
final wordHintResponse = await duolingo.wordHint(
fromLanguage: 'en',
learningLanguage: 'es',
sentence: 'bolĂgrafos',
);
for (final token in wordHintResponse.tokens) {
final headers = token.table.headers;
for (final header in headers) {
print(header.selected);
print(header.token);
}
final rows = token.table.rows;
for (final row in rows) {
for (final cell in row.cells) {
print(cell.hint);
}
}
}
}
Implementation
Future<WordHintResponse> wordHint({
String fromLanguage,
String learningLanguage,
required String sentence,
});