oxford_dictionary 2.0.3 copy "oxford_dictionary: ^2.0.3" to clipboard
oxford_dictionary: ^2.0.3 copied to clipboard

Oxford Dictionary Dart client. Use it to get word definitions, pronunciations and examples.

Oxford Dictionary API Wrapper in Dart #

The package is under development and doesn't have all API functionality. Feel free to contribute!

The Oxford Dictionaries API offers an easy way to access powerful lexical data (words, definitions, translations, audio pronunciations, synonyms, antonyms, parts of speech, and more) to use in your apps and websites.

To test package soundness there was 100 requests saved with according responses in test/fixtures/{entries,lemmas}/ folders. If you encounter any null value error please open an issue in repository Issues page.

See Contribution guidelines for this project

Read Oxford Dictionaries Documentation

Getting Started #

git clone git@github.com:rIIh/oxford-dictionary.git && cd oxford-dictionary
flutter pub get
flutter pub run build_runner build

How to use #

See example for more usecase information.

void main() async {
  final dictionary = OxfordDictionary(
    'en',
    Platform.environment['APP_ID'],
    Platform.environment['APP_KEY'],
  );

  // get word definition entry
  final word = await dictionary.entries.search(wordString);

  // get phrases
  final phrases = word.phrases.values.map((phrases) => phrases).expand((phrases) => phrases).toList();

  // get pronunciations
  final pronunciations = word.variants.values
      .map((e) => e.map((e) => e.pronunciations))
      .expand((pronunciations) => pronunciations)
      .toList();

  // get senses
  final senses = word.variants.values
      .map((variants) => variants?.map((variant) => variant.senses))
      .expand((senses) => senses)
      .toList();

  // get definitions
  final definitions = senses.map((e) => e.map((e) => e.definitions)).expand((definitions) => definitions).toList();

  // get sub senses
  final subSenses = senses.map((e) => e.map((e) => e.subSenses)).expand((subSenses) => subSenses).toList();
}
9
likes
100
pub points
34%
popularity

Publisher

unverified uploader

Oxford Dictionary Dart client. Use it to get word definitions, pronunciations and examples.

Homepage

Documentation

API reference

License

MIT (LICENSE)

Dependencies

chopper, http, json_annotation, stash

More

Packages that depend on oxford_dictionary