I'm trying to Integrate the API using model. Let say I have a book screen, so I'm trying to get its API data using model. my model looks like this.

```
class Book {
  final int id;
  final String phone;
  final String name;
  final String relation;
  final String updated_at;
  final String created_at;
  final int userId;

  Book(
      {required this.id,
      required this.name,
      required this.phone,
      required this.relation,
      required this.created_at,
      // required this.image,
      required this.updated_at,
      required this.userId,

      });

  factory Book.fromJson(Map<String, dynamic> json) => Book(
        id: json['user_id'],
        name: json['contact_person'],
        relation: json['relation'],
        phone: json['phone'],

        updated_at: json['updated_at'],
        created_at: json['created_at'],
        userId: json['id']

      );

  Map<String, dynamic> toJson() => {
        'user_id': userId,
        'contact_person': phone,
        'relation': relation,
        'name': name,
        'created_at':created_at,
        'updated_at':updated_at,
        'id':id,

      };
}

```

calling this api like this

```
 Future<List<Book>> getBook() async {
     List<Book> _bookList =[];

    Map<String, String> headers = {
      "Content-type": "application/json",
      'Authorization': 'Bearer $token',
    };
      var url = Uri.parse(ApiPath.getAllEmergenceyContactUrl);
      final response = await http.get(url, headers: headers);
    if (response.statusCode == 200) {

     Map<String, dynamic> map = json.decode(response.body);
     List<dynamic> data = map["user"];
      if(data.length>0){
        for(int i=0;i<data.length;i++){
          if(data[i]!=null){
            Map<String,dynamic> map=data[i];
            _bookList.add(Book.fromJson(map));
            debugPrint('Id-------${map['contact_person']}');  //this print the correct data
          }
        }
      }
      print(_bookList);
      return _bookList;

    } else {
      // If that call was not successful, throw an error.
      throw Exception('Failed to load post');
    }
}

```

`print(_bookList);` this give me this output
`[Instance of 'Book', Instance of 'Book']`

and calling in User Interface like this

```
 List<Book> books = [];
getAllEmergenceyContacts()async{
      var books = await services.getBook();

  }

```

i can't able to get the the when using the books in listview builder, please help me out.

my json data look like this

```
{
    "status": 1,
    "message": "your emergency contacts",
    "user": [
        {
            "id": 10,
            "user_id": 49,
            "contact_person": "ABC",
            "relation": "DSVKJDSB",
            "phone": "sdfsdf",
            "image": "emergency/1735686398652391.png",
            "created_at": "2022-06-15T07:52:19.000000Z",
            "updated_at": "2022-06-15T07:52:19.000000Z"
        },
]}

```

and i want `user` array data from it.