title: NoSuchMethodError: The getter 'length' was called on null
body: <p>So currently I'm building apps with Flutter which's still new to me, and I'm stuck at that exception in that title.</p>
  <p>The problem is when I tried to call &quot;widget.usernames.length&quot; at ListView.builder, it would return that exception if it's null and no exception when there's data.</p>
  <p>What I'm trying to accomplish is the get Length function should return null or 0 value so that the ListView would display nothing when there's no data.</p>
  <pre><code>return new Expanded(
    child: ListView.builder(
        padding: new EdgeInsets.all(8.0),
        itemExtent: 20.0,
        itemCount: widget.usernames.length,
        itemBuilder: (BuildContext context, int index){
          return Text(&quot;Bank ${widget.usernames[index] ?? &quot; &quot;}&quot;);
        }
    ),
  );
  </code></pre>
  <p>I already tried</p>
  <pre><code>itemCount: widget.usernames.length ?? 0
  </code></pre>
  <p>but still no success.</p>
  <p>EDIT**</p>
  <p>Thanks to Jeroen Heier this code working well.</p>
  <pre><code>var getUsernameLength = 0 ;
  if(widget.usernames == null){
    return getUsernameLength;
  }else{
    return widget.usernames.length;
  }
  </code></pre>