title: How to check for null widget value in dart ternary operator to display default image if null?
body: <p>Hello I need some help with my flutter code
  I'm loading my data from json and passing the data from one screen to another screen.
  I want to use a ternary operator to check for null but keep getting errors.</p>
  
  <p>I want to load a default image if there is no data, I'm getting error - <strong>failed expression: a boolean expression must not be null.</strong></p>
  
  <p>Below is a snippit of my code inside a stateful widget
  widget.image contains the data for the image</p>
  
  <pre><code>class DetailScreen extends StatefulWidget {
  
    //load json data to each section, using index provided from list page.
  
    final herbName;
    final index;
    final image;
    final text;
    DetailScreen({this.herbName,this.index,this.image,this.text});
  
    @override
    _DetailScreenState createState() =&gt; _DetailScreenState();
  }
  </code></pre>
  
  <p>//the code below is located inside State</p>
  
  <pre><code>BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(30.0)),
                color: Colors.redAccent,
                image: DecorationImage(
                  fit: BoxFit.cover,
                  image: **widget.image ? NetworkImage("http://images.neopets.com/altador/altadorcup/signup_full.gif")
                      :
  
                  NetworkImage(widget.image),**
  
                )),
  </code></pre>