Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override gives me an error I cant find the function

Tags:

flutter

dart

Use ; instead of {} for empty constructor bodies.dart(empty_constructor_bodies) A function body must be provided. Try adding a function body.dart(missing_function_body)

import 'package:flutter/material.dart';
import './question.dart';
import './answer.dart';

class Quiz extends StatelessWidget {
  final int questionIndex;
  final List<Map<String, Object>> questions;
  final Function answerQuestion;

  Quiz(this.questionIndex,this.questions,this.answerQuestion)

  @override

  Widget build(BuildContext context) {
    return Column(
                children: [
                  Question(
                    questions[questionIndex]['questionText'],
                  ),
                  ...(questions[questionIndex]['answers'] as List<String>)
                      .map((answer) {
                    return Answer(answerQuestion, answer);
                  }).toList()
                ],
              );
  }
}

image

like image 588
S A Saharukh Avatar asked Oct 23 '19 07:10

S A Saharukh


1 Answers

You need to add a ; at the end of the constructor:

Quiz(this.questionIndex,this.questions,this.answerQuestion);
like image 131
Pablo Barrera Avatar answered Nov 03 '22 19:11

Pablo Barrera