when I'm trying call the api it gets called and it reaches the `itemCount` in the `ListView.builder` but then it shows error like this,

> 
> The getter 'length' was called on null.
> 
> 
> 

```
class ChopperNewsCard extends StatefulWidget {
  @override
  _ChopperNewsCardState createState() => _ChopperNewsCardState();
}

class _ChopperNewsCardState extends State<ChopperNewsCard> {
  ScrollController scrollController = ScrollController();
  ApiCall apiCall = ApiCall();
  ChopperNews res = ChopperNews();
  Future<void> getResponse() async {
    res = await apiCall.getNews(5);
  }

  @override
  void initState() {
    super.initState();

    getResponse();
  }

  @override
  void dispose() {
    super.dispose();
    scrollController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    var height = MediaQuery.of(context).size.height;
    var width = MediaQuery.of(context).size.width;
    return Container(
      height: height * 0.37,
      width: double.infinity,
      child: ListView.builder(
        itemCount: res.articles.length + 1, //<--------here length getting null
        controller: scrollController,
        physics: AlwaysScrollableScrollPhysics(),
        scrollDirection: Axis.horizontal,
        shrinkWrap: true,
        itemBuilder: (context, index) {
          if (index == res.articles.length) {
            if (index == res.totalResults) {
              return null;
            } else {
              return Center(child: CircularProgressIndicator());
            }
          } else {
            return Container(
              width: width * 0.70,
              padding: EdgeInsets.only(right: width * 0.05),
              child: Card(
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(15),
                ),
                elevation: 3,
                child: Column(
                  children: [
                    ClipRRect(
                      borderRadius: BorderRadius.circular(15),
                      child: CachedNetworkImage(
                        imageUrl: res.articles[index].urlToImage == null
                            ? Url.noImage
                            : res.articles[index].urlToImage,
                        fit: BoxFit.cover,
                        width: double.infinity,
                        height: height * 0.2,
                        placeholder: (context, url) =>
                            Center(child: CircularProgressIndicator()),
                        errorWidget: (context, url, error) =>
                            Icon(Icons.error_outline_sharp),
                      ),
                    ),

                  ],
                ),
              ),
            );
          }
        },
      ),
    );
  }
}

```

from where I'm trying to call my api,

```
import 'package:chopper/chopper.dart';
import '../models/chopper_news.dart';

import 'chopper_api_service.dart';

class ApiCall {
  ChopperApiService chopperApiService;
  Future<ChopperNews> getNews(int page) async {
    chopperApiService = ChopperApiService.create();
   var apiResponse = await chopperApiService.getNews(pageSize: page);
    return apiResponse.body;
  }
}

```

in debug mode it shows response after the length is getting called null so my api calls I think are working fine