I am trying to fetch google book search api data.
I think I have same issue with this.
how to get data?
CodePudding user response:
because title
and author
is not inside item
object, it inside volumeInfo
, so you much change fromJson
method of your Book class to
factory Book.fromJson(Map json) {
return Book(
id: json['id'],
title: json['volumeInfo']['title'],
authors: json['volumeInfo']['author'],
);
}