lemmas method

Future<List> lemmas(
  1. String word
)

lemmas is a class for making HTTP requests to the ZEMBEREK API using the word parameter and print word in the console.

Implementation

Future<List<dynamic>> lemmas(String word) async {
  try {
    var url = (Uri.parse('$ipAdresi:$port/lemmas'));
    var res = await http.post(url, body: {'word': word});
    var body = res.body;
    var decoded = jsonDecode(body);
    var cevap = decoded["results"][0]["lemmas"];
    return cevap;
  } catch (e) {
    var hata = e.toString();
    if (hata.contains('NoSuchMethodError')) {
      var sozlukanlam = "Probably System Error. Open an issue on GitHub.";
      print(sozlukanlam);
      return [];
    } else {
      var sozlukanlam = e.toString();
      print(sozlukanlam);
      return [];
    }
  }
}