title: Exception caught by widgets library ,The following assertion was thrown building Answer **error** in flutter
body: <p><a href="https://i.stack.imgur.com/tfngW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tfngW.jpg" alt="" /></a></p>
  <p>I'm new to flutter , or programming to be clear . I was following a course , doing the same as the Instructor , the app worked for him , but when i try to run it ,this error shows up .</p>
  <pre><code>// @dart=2.9
  
  import 'package:flutter/material.dart';
  import 'package:flutter/services.dart';
  import './question.dart';
  import './answer.dart';
  
  
  
  class Quiz extends StatelessWidget {
    final List&lt;Map&lt;String, Object&gt;&gt; questions;
    final int questionIndex;
    final Function answerQuestion;
  
    Quiz(
        {@required this.questions,
        @required this.answerQuestion,
        @required this.questionIndex});
  
    @override
    Widget build(BuildContext context) {
      return ListView(
        children: [
          Question(
            questions[questionIndex]['questionText'],
          ),
          ...(questions[questionIndex]['answers'] as List&lt;Map&lt;String, Object&gt;&gt;)
              .map((answer) {
            return Answer(() =&gt; answerQuestion(answer['score']), answer['text']);
          }).toList()
        ],
      );
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/tfngW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tfngW.jpg" alt="enter image description here" /></a></p>