import 'package:flutter/material.dart';
class Answers extends StatelessWidget {
final Function nextQuestion;
Answers(this.nextQuestion);
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: nextQuestion,
child: Text("Answer"),
);
}
}
答案 0 :(得分:1)
只需将 nextQuestion
的类型更改为 void Function()
:
final void Function() nextQuestion;