gpt4 book ai didi

flutter - 覆盖给我一个错误,我找不到函数

转载 作者:行者123 更新时间:2023-12-03 02:38:56 27 4
gpt4 key购买 nike

对于空的构造函数主体,请使用;而不是{}.dart(empty_constructor_bodies)
必须提供一个功能主体。
尝试添加一个函数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

最佳答案

您需要在构造函数的末尾添加;:

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

关于flutter - 覆盖给我一个错误,我找不到函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58517802/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com