I am trying to get the JSON response from the server and output it to the console.
Future login() async {
var response = await http.get(
You can get this error if you are using retrofit.dart and declare the wrong return type for your annotated methods:
@GET("/search")
Future> getResults();
// wrong! search results contains a List but the actual type returned by that endpoint is SearchResults
vs
@GET("/search")
Future getResults();
// correct for this endpoint - SearchResults is a composite with field for the list of the actual results