0 purchases
yandex dictionary api
Yandex Dictionary Api #
Package to access the Yandex.Dictionary API over HTTP.
Getting Started #
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies:
...
yandex_dictionary_api: ^latest
copied to clipboard
Import it:
import 'package:yandex_dictionary_api/yandex_dictionary_api.dart';
copied to clipboard
Usage Examples #
Create the Yandex Dictionary API object as follows.
final yandexDictionaryKey = YandexDictionaryKey(apiKey: '');
final yandexDictionaryApi = YandexDictionaryApi(key: yandexDictionaryKey);
copied to clipboard
You can call 2 functions with yandexDictionaryApi: getLangs and lookup.
getLangs
Returns a list of translation directions supported by the service.
final getLangsResponse = await yandexDictionaryApi.getLangs();
copied to clipboard
The lookup service can be used with the language list returned from here.
lookup
Searches for a word or phrase in the dictionary and returns an automatically generated dictionary entry.
final lookupRequest = YandexLookupRequest(lang: 'en-ru', text: 'hello');
final result = await yandexDictionaryApi.lookup(lookupRequest);
copied to clipboard
Error Handling #
API throws YandexDictionaryException in incorrect cases.
YandexDictionaryInvalidKeyException
Thrown when invalid API key.
YandexDictionaryBlockedKeyException
Thrown when this API key has been blocked.
YandexDictionaryDailyRequestLimitException
Exceeded the daily limit on the number of requests.
YandexDictionaryTextTooLongException
The text size exceeds the maximum.
YandexDictionaryLangNotSupportedException
The specified translation direction is not supported.
YandexDictionaryUnknownException
Thrown when unknown error cases.
For more API documentation #
visit offical API documentation
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.