DictionaryResponse class

This class represents the response object returned from the Dictionary API.

This entity object contains dictionary-like detailed information about a particular word. It also contains other information such as Discussion about this subject and AlternativeForm using this subject.

From this response, you can refer to the information on the official Duolingo page at the following URL: https://www.duolingo.com/dictionary/Japanese/%E6%95%B0%E5%AD%A6/00a6288128ad4e286a35078ded5ffde9

Example:

void main() async {
 final duolingo = Duolingo.instance;

 final authResponse = await duolingo.authenticate(
   username: 'test_username',
   password: 'test_password',
 );

 final dictionaryResponse = await duolingo.dictionary(
   wordId: 'cbdb71cdcf9e4715771206e1c0b0b94c',
 );

 print(dictionaryResponse);

 for (final alternativeForm in dictionaryResponse.alternativeForms) {
   print(alternativeForm);
 }

 for (final discussion in dictionaryResponse.relatedDiscussions) {
   print(discussion);
 }

 for (final lexeme in dictionaryResponse.relatedLexemes) {
   print(lexeme);
 }
}
Inheritance

Constructors

DictionaryResponse.from({required int statusCode, required String reasonPhrase, required Map<String, String> headers, required String id, required String word, required String imageUrl, required String fromLanguage, required String learningLanguage, required String fromLanguageName, required String learningLanguageName, required String pos, required String infinitive, required String translations, required String ttsUrl, required String canonicalUrl, required List<AlternativeForm> alternativeForms, required List<Lexeme> relatedLexemes, required List<Discussion> relatedDiscussions, required bool isGeneric, required bool hasTts})
Returns the new instance of DictionaryResponse based on arguments.

Properties

alternativeForms List<AlternativeForm>
The alternative forms
final
canonicalUrl String
The canonical url of this dictionary
final
fromLanguage String
The from language
final
fromLanguageName String
The name of from language
final
hashCode int
The hash code for this object.
no setteroverride
hasTts bool
The flag that represents it has TTS or not
final
headers Map<String, String>
The http headers
finalinherited
id String
The id
final
imageUrl String
The image url
final
infinitive String
The infinitive
final
isGeneric bool
The flag that represents this is generic or not
final
learningLanguage String
The learning language
final
learningLanguageName String
The name of learning language
final
pos String
The pos
final
relatedDiscussions List<Discussion>
The related discussions
final
relatedLexemes List<Lexeme>
The related lexemes
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
status Status
The http status
finalinherited
translations String
The translations
final
ttsUrl String
The url of TTS
final
word String
The word
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override