I searched tutorials and library documentations which I already followed the sample codes using either Dio or Http. However, I don’t know why I cannot get response from calling the api. There is no error and any message allow me to debug. I read the logging from cloudwatch for the api gateway. There is no trigger occured. The app cannot be processed any more after call the api as I use await for waiting the response. How should I fix it?
Future<void> makeGetRequest() async {
try {
const url =
'https://918pynqzta.execute-api.ap-southeast-1.amazonaws.com/dev/getAllElderly';
final uri = Uri.parse(url);
final response = await http.get(uri);
print(response);
} catch (e) {
print('Error: $e');
}
}
ElevatedButton(
onPressed: () async {
await makeGetRequest();
},)
Matthew Lau is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.