title: How can I solve the error that I get when compiling my mobile app in flutter?
body: <p><em>This is the error I get when compiling</em></p>
  
  <p><strong>An Observatory debugger and profiler on AOSP on IA Emulator is available at: <a href="http://127.0.0.1:55598/YYOpp337z7w=/" rel="nofollow noreferrer">http://127.0.0.1:55598/YYOpp337z7w=/</a>
  E/flutter (19984): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method 'toDouble' was called on null.
  E/flutter (19984): Receiver: null
  E/flutter (19984): Tried calling: toDouble()</strong></p>
  
  <p><strong><em>This is the class where I make the request to the REST API</em></strong></p>
  
  <pre><code>class HttpHandler{
  
  final String  _baseUrl = "api.themoviedb.org";
    final String _lenguaje = "es-ES";
  
  Future&lt;dynamic&gt; getJson(Uri uri) async{
        //Primera peticion api  
      http.Response response = await http.get(uri); //amacena la respuesta
      return json.decode(response.body);
  
      }
  
      Future&lt;List&lt;Media&gt;&gt; fetchMovies(){
        //define la la url
        var uri = new Uri.https(_baseUrl, "3/movie/popular",{
          'api_key' : API_KEY,
          'page': "1",
          'language ': _lenguaje
        });
  
        return getJson(uri).then(((data) =&gt;
            data['results'].map&lt;Media&gt;((item)=&gt;new Media(item)).toList()
        ));
      }
  </code></pre>
  
  <p><strong><em>My constructor method based on the design of the object that the API request sends me</em></strong></p>
  
  <pre><code>class Media {
  
    int id;
    double voteAverage;
    String title;
    String posterPath;
    String  backdropPath;
    String overview;
    String releaseDate;
    List&lt;dynamic&gt; genreIds;
  
    String getPosterUrl() =&gt; getMediumPictureUrl(posterPath);
  
  //Definir el constructor
  //Basado de diseño de factory en la base de disñeo de objetos
  factory Media(Map jsonMap){
      try {
         return new Media.deserialize(jsonMap);
      } catch (ex) {
  
        throw ex;
       }
  
       }
  
      Media.deserialize(Map json) :
      id = json["id"].toInt(),
      voteAverage = json["voteAverage"].toDouble(),
      title = json["title"],
      posterPath = json["posterPath"]?? "",
      backdropPath = json["backdropPath"]?? "",
      overview =  json["overview"],
      releaseDate = json["releaseDate"],
      genreIds = json["genreIds"].toList;
  
  
  }
  </code></pre>
  
  <p><strong><em>This is the flutter view where the request is called to show in this case a list of movies</em></strong></p>
  
  <pre><code>class MediaList extends StatefulWidget {
    @override
    _MediaListState createState() =&gt; new _MediaListState();
   }
  class _MediaListState extends State&lt;MediaList&gt; {
  List&lt;Media&gt; _media = new List();
    @override
    void initState(){
      super.initState();
      loadMovies();
    }
    void loadMovies()async{
      var movies = await HttpHandler().fetchMovies();
      setState(() {
        _media.addAll(movies);
      });
    }
  
    @override
    Widget build(BuildContext context) {
     return new Container(
       child: new ListView.builder(
         itemCount: _media.length,
         itemBuilder: (BuildContext context ,int index){
            return new Column(
              children: &lt;Widget&gt;[
                  new Image.network(_media[index].getPosterUrl())
              ],
            );
         },
       ),
  
     );
    }
  }
  </code></pre>