how to create a method that will call URL's From a list with flutter


I am working with google books in my flutter project.
im trying to create a method that that will call the diffrent books URL’s that i have stored in a List and call the list back using a future builder.

The list look somthing like this:

List<String> toBeReadBooksList = [''];


You can do it a way that similar to this:

final url = '';
final response = await http.get(url)

if (response.statusCode == 200) {
  // Here you need to parse data from response, you should replace it with your realization:
  return Data.fromJson(jsonDecode(response.body));
} else {
  throw Exception('Failed to load data from $url');

You can read more about how to work with requests and responses to/from the Network in Official Documentation.

Answered By – fartem

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *