I am receiving api data from a modern application. I used API json response to do this. I will search for a word in the search box, but I cannot see the 1 values while I get the 0 values in the API. I would be glad if you can help me.
return ResponseModel.fromJson(data[0]); My data value is not increasing.
type here
class API {
static const String baseUrl = "https://sozluk.gov.tr/gts_id?id=";
static Future<ResponseModel> fetchMeaning(String word) async {
final response = await http.get(Uri.parse("$baseUrl$word"));
if (response.statusCode == 200) {
final data = json.decode(response.body);
return ResponseModel.fromJson(data[0]);
} else {
throw Exception("failed to load meaning");
}
}
}
New contributor
Ömer Faruk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.