title: flutter - The argument type 'void Function(int)' can't be assigned to the parameter type 'void Function()'\
body: <p>Hi I'm learning flutter via a tutorial. In that tutorial they downgraded the dart version but I'm trying to work without downgrading the dart. I'm getting two errors The argument type 'void Function(int)' can't be assigned to the parameter type 'void Function()'.dartargument_type_not_assignable &amp; Too many positional arguments: 0 expected, but 1 found. I'm trying to figure out how to solve that error.</p>
  <pre><code>    **main.dart file**
      
      class _MyAppState extends State&lt;MyApp&gt; {
        final _questions = const [
          {
            &quot;question&quot;: &quot;What's your favourite color?&quot;,
            &quot;answers&quot;: [
              {&quot;text&quot;: &quot;Red&quot;, &quot;score&quot;: 10},
              {&quot;text&quot;: &quot;Green&quot;, &quot;score&quot;: 5},
              {&quot;text&quot;: &quot;Blue&quot;, &quot;score&quot;: 3},
              {&quot;text&quot;: &quot;White&quot;, &quot;score&quot;: 1}
            ],
          },
          {
            &quot;question&quot;: &quot;What's your favourite animal?&quot;,
            &quot;answers&quot;: [
              {'text': 'Rabbit', 'score': 3},
              {'text': 'Snake', 'score': 11},
              {'text': 'Elephant', 'score': 5},
              {'text': 'Lion', 'score': 9},
            ],
          },
          {
            &quot;question&quot;: &quot;What's your favourite food?&quot;,
            &quot;answers&quot;: [
              {'text': 'Biryani', 'score': 3},
              {'text': 'Dosa', 'score': 11},
              {'text': 'Idly', 'score': 5},
              {'text': 'Poori', 'score': 9},
            ],
          },
        ];
        var _questionIndex = 0;
        var _totalScore = 0;
      
          void _answerQuestion(int score) {
          _totalScore += score;
          setState(() {
            _questionIndex = _questionIndex + 1;
          });
          
        }
      
        @override
        Widget build(BuildContext context) {
          return MaterialApp(
            debugShowCheckedModeBanner: false,
            home: Scaffold(
              appBar: AppBar(
                title: const Text(&quot;My First App&quot;),
              ),
              body: _questionIndex &lt; _questions.length
                  ? Quiz(
                      answerQuestion: _answerQuestion,//The argument type 'void Function(int)' can't be assigned to the parameter type 'void Function()'.dartargument_type_not_assignable
                      questionIndex: _questionIndex,
                      questions: _questions,
                    )
                  : const Result(),
            ),
          );
        }
      }
  **quiz.dart file**
  class Quiz extends StatelessWidget {
    final List&lt;Map&lt;String, Object&gt;&gt; questions;
    final VoidCallback answerQuestion;
    dynamic questionIndex;
    Quiz(
        {required this.questions,
        required this.answerQuestion,
        required this.questionIndex,
        super.key});
  
    @override
    Widget build(BuildContext context) {
      return Column(
        children: [
          Question(questions[questionIndex][&quot;question&quot;] as String),
          ...(questions[questionIndex][&quot;answers&quot;] as List&lt;Map&lt;String, Object&gt;&gt;)
              .map(
                (answer) =&gt; Answer(() =&gt; answerQuestion(answer[&quot;score&quot;]),//Too many positional arguments: 0 expected, but 1 found.
  
                 answer[&quot;text&quot;] as String),
              )
              .toList()
        ],
      );
    }
  }
  **answer.dart file**
  class Answer extends StatelessWidget {
    final VoidCallback? selectHandler;
    final String? answerText;
    const Answer(this.selectHandler, this.answerText, {super.key});
  
    @override
    Widget build(BuildContext context) {
      return Container(
        width: double.infinity,
        child: ElevatedButton(
          style: ElevatedButton.styleFrom(
            backgroundColor: Colors.blue,
          ),
          onPressed: selectHandler,
          child:  Text(answerText!),
          
        ),
      );
    }
  }
  </code></pre>