title: A value of type 'Future<List<Question>>' can't be assigned to a variable of type 'List<Question>'
body: <pre><code>import 'dart:async';
  import 'question.dart';
  import 'package:http/http.dart' as http;
  import 'dart:convert';
  
  String opentdb = 'https://opentdb.com/api.php?amount=15&amp;type=boolean';
  
  class QuestionServices {
    Future&lt;List&lt;Question&gt;&gt; getData() async {
      List&lt;Question&gt; questions;
      String link = opentdb;
      var res = await http
          .get(Uri.encodeFull(link), headers: {"Accept": "application/json"});
      print(res.body);
      if (res.statusCode == 200) {
        var data = json.decode(res.body);
        var rest = data['results'] as List;
        print(rest);
        questions =
            rest.map&lt;Question&gt;((json) =&gt; Question.fromJson(json)).toList();
      }
      print("List Size: ${questions.length}");
      // _questions = questions;
      return questions;
    }
  
    List&lt;Question&gt; newQuestions = getData();
  }
  </code></pre>
  
  <pre><code>class Question {
    final String question;
    final bool answer;
  
    Question({this.question, this.answer});
  
    factory Question.fromJson(Map&lt;String, dynamic&gt; json) {
      return Question(
        question: json['question'] as String,
        answer: json['correct_answer'] as bool,
      );
    }
  }
  </code></pre>
  
  <p>I am trying to create a list of questions from a JSON database but whenever I try to get the returned list I get the error:</p>
  
  <pre><code>"A value of type 'Future&lt;List&lt;Question&gt;&gt;' can't be assigned to a variable of type 'List&lt;Question&gt;'."
  </code></pre>
  
  <p>I am unsure why the List I'm returning is giving out that error. Is there maybe a different way to get a json to a list?</p>