title: Flutter throwing error for null string even though I used await to wait for other function to send data first
body: <p>I am getting part of the URL from as the app loads which then sends it to the searchSingleMovie function to call an API to get more information.
  My problem is I'm using Future and await but I still keep getting an error. I know why the error occurs (because the value of the string is null in the beginning) but I don't know how to fix the issue. I don't think I can use two awaits together.
  Any help will be appreciated. The code and error are given below:</p>
  
  <pre><code>Future&lt;List&lt;void&gt;&gt; getSingleMovie(String url,String item) async {
     var response = await http.get( Uri.encodeFull(url), //error here, url is null first
       headers: {'Accept': 'application/json'});
  
  /decode and store the first 20 corresponding movie info in each variable
       setState(() {
         var urlData = json.decode(response.body);
         for(int i = 0; i &lt; 20; i++) {
           if(urlData['results'][i]['poster_path'] == item) {
             picURL = urlData['results'][i]['poster_path'];
             title = urlData['results'][i]['title'];
             releaseDate = urlData['results'][i]['release_date'];
             description = urlData['results'][i]['overview'];
             id = urlData['results'][i]['id'];
             rating = urlData['results'][i]['vote_average'].toDouble();
           }
         }
       });
  
  </code></pre>
  
  <p>And here is the error:</p>
  
  <pre><code>E/flutter (19426): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'length' was called on null.
  E/flutter (19426): Receiver: null
  E/flutter (19426): Tried calling: length
  E/flutter (19426): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
  E/flutter (19426): #1      _Uri._uriEncode (dart:core-patch/uri_patch.dart:46:23)
  E/flutter (19426): #2      Uri.encodeFull (dart:core/uri.dart:1150:17)
  E/flutter (19426): #3      HomePageState.getSingleMovie (package:showgrabber/view/HomePage.dart:105:39)
  E/flutter (19426): #4      HomePageState.initState (package:showgrabber/view/HomePage.dart:97:10)
  E/flutter (19426): #5      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
  E/flutter (19426): #6      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
  E/flutter (19426): #7      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)```
  
  </code></pre>