title: Error:-The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type
body: <p>I am currently building a botcoin ticker app that returns a list of currencies to a dropDown menu .
  I am getting the following errors:-</p>
  <p>error: The body might complete normally, causing 'null' to be returned, but the return type is a potentially non-nullable type. (body_might_complete_normally at [bitcoin_ticker] lib\price_screen.dart:10)</p>
  <p>error: The argument type 'List&lt;DropdownMenuItem&gt;' can't be assigned to the parameter type 'List&lt;DropdownMenuItem&gt;?'. (argument_type_not_assignable at [bitcoin_ticker] lib\price_screen.dart:60)</p>
  <p>Here is my code</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'coin_data.dart';
  int i = 0;
  class PriceScreen extends StatefulWidget {
    @override
    _PriceScreenState createState() =&gt; _PriceScreenState();
  }
  
  
  List&lt;DropdownMenuItem&gt; getDropDownItems() {
  
    List&lt;DropdownMenuItem&lt;String&gt;&gt; dropdownItem = [];
    for (String currency in currenciesList) {
       DropdownMenuItem(
        child: Text(currency), //
        value: currency,
      );
    }
  }
  class _PriceScreenState extends State&lt;PriceScreen&gt; {
    late String selectedCurrency = 'USD';
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text(' Coin Ticker'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: &lt;Widget&gt;[
            Padding(
              padding: EdgeInsets.fromLTRB(18.0, 18.0, 18.0, 0),
              child: Card(
                color: Colors.lightBlueAccent,
                elevation: 5.0,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10.0),
                ),
                child: Padding(
                  padding: EdgeInsets.symmetric(vertical: 15.0, horizontal: 28.0),
                  child: Text(
                    '1 BTC = ? USD',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontSize: 20.0,
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
            ),
            Container(
              height: 150.0,
              alignment: Alignment.center,
              padding: EdgeInsets.only(bottom: 30.0),
              color: Colors.lightBlue,
              child: DropdownButton&lt;String&gt;(
                value:selectedCurrency,//Default value
                items: getDropDownItems(),
               onChanged:(value){//it is like an on Pressed Button
                  setState(() {
                    selectedCurrency = value!;
                    print(selectedCurrency);
                  });
               },
              ),
            ),
          ],
        ),
      );
    }
  
  }
  </code></pre>