spellingCheck method

Future<String> spellingCheck(
  1. String word
)

spellingCheck is a class for making HTTP requests to the ZEMBEREK API using the word parameter.

Implementation

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