Widget _buildSwitchListTile(
String title,
String description,
bool currentValue,
VoidCallback updateValue) {
return SwitchListTile(
value: currentValue,
title: Text(title),
subtitle: Text(description),
onChanged: updateValue,
);
CodePudding user response:
You can use this:
final void Function()? onTap;
and if you want, that function passed some data, you can use it like this:
final void Function(bool)? onTap;
CodePudding user response:
SwitchListTile
onChanged
provide a nullable bool on callback.
Try changing Function(bool) updateValue
Widget _buildSwitchListTile(
String title,
String description,
bool currentValue,
Function(bool) updateValue) {
return SwitchListTile(
value: currentValue,
title: Text(title),
subtitle: Text(description),
onChanged: updateValue,
);