define method

Future<OwlBotResponse?> define({
  1. required dynamic word,
})

Get the definitions for the word and returns OwlBotResponse which contains the pronounciation, and list of Definition

Implementation

Future<OwlBotResponse?> define({required word}) async {
  final client = http.Client();
  final res = await client.get(Uri.parse("$_baseURL/api/v4/dictionary/$word"),
      headers: {'Authorization': 'Token $token'});
  if (res.statusCode == 200) {
    return OwlBotResponse.fromJson(json.decode(res.body));
  } else {
    return null;
  }
}