I am getting error while trying to pass bool value to the TaskCheckbox() method. I am new to flutter and any help would be much appreciated
class _TaskTileState extends State<TaskTile> {
bool? isChecked = false;
@override
Widget build(BuildContext context) {
return const ListTile(
title: Text('This is a task'),
trailing: TaskCheckbox(isChecked),
);
}
}
class TaskCheckbox extends StatelessWidget {
final bool? checkboxState;
const TaskCheckbox(this.checkboxState, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Checkbox(
value: checkboxState,
onChanged: (newValue) {},
);
}
}