title: How to fix "the getter 'length' was called on null" error in Flutter
body: <p>I am trying to display my list of stuff and it keeps on failing, the snapshot.data seems to be null. please how do i fix this. i have added the CheckList class for simulation. i have tried changing checkList.length to checkList?.length ?? 0 and it still didnt work, i have check the path 'data/checklist.json' its good.</p>
  
  <pre><code> class CheckList {
    final String checkListName;
    final ItemList list;
    final int total;
  
    CheckList({this.checkListName, this.list, this.total});
    factory CheckList.fromJson(Map&lt;String, dynamic&gt; json) {
      return new CheckList(
        checkListName: json['checkListName'],
        list: ItemList.fromJson(json['list']),
        total: json['total'],
      );
    }
  
    static Future&lt;List&lt;CheckList&gt;&gt; browse() async {
      String content = await rootBundle.loadString('data/checklist.json');
  
      await Future.delayed(Duration(seconds: 1));
  
      List collection = json.decode(content);
      List&lt;CheckList&gt; _checklist =
        collection.map((json) =&gt; CheckList.fromJson(json)).toList();
  
      return _checklist;
  
    }
  }
  
  Future&lt;List&lt;CheckList&gt;&gt; checkList;
  
  @override
  void initState() {
      super.initState();
      checkList = CheckList.browse();
  }
  
  body: FutureBuilder(
          future: checkList, // a previously-obtained Future&lt;String&gt; or null
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            switch (snapshot.connectionState) {
              case ConnectionState.none:
              case ConnectionState.active:
              case ConnectionState.waiting:
                return Center(child: CircularProgressIndicator());
              case ConnectionState.done:
                // if (snapshot.hasError) return Text('Error is: ${snapshot.error}');
                var checkList = snapshot.data;
                return ListView.separated(
                  itemCount: checkList.length,
                  itemBuilder: (BuildContext context, int index) {
                    CheckList checklist = checkList[index];
                    return ListTile(
                      title: Padding(
                        padding: const EdgeInsets.fromLTRB(0, 15, 0, 0),
                        child: Text(
                          checklist.checkListName,
                          style: TextStyle(fontWeight: FontWeight.bold),
                        ),
                      ),
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fUx9o.png" rel="nofollow noreferrer">enter image description here</a></p>