getSynonyms method
Implementation
Future<Synonym> getSynonyms(
String sourceText, {
String from = autoLanguage,
}) async {
final HttpResponseData httpResponseData =
await _getData(sourceText, from, dataType: 'ss');
final jsonData = httpResponseData.jsonData;
final List<String> filteredData = [];
try {
final indexedData = jsonData[_map[RequestType.synonym]];
for (final i in indexedData) {
for (final n in i[1]) {
for (final t in n[0]) {
filteredData.add(t as String);
}
}
}
} catch (e) {
_throwBadDataException(
RequestType.synonym,
httpResponseData,
innerException: e,
);
}
filteredData.removeRange(5, filteredData.length);
return Synonym(
filteredData,
source: sourceText,
sourceLanguage: _languageList[from],
);
}