Error in onPressed Trying to pass onPressed Function but getting Error.
Error - The argument type 'Function' can't be assigned to the parameter type 'void Function()?'.
class CircleButton extends StatelessWidget {
CircleButton({required this.icon, required this.onPressed});
final IconData icon;
final Function onPressed; [![Error][1]][1]//Here
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: Icon(icon),
onPressed: onPressed,
style: ElevatedButton.styleFrom(
elevation: 6.0,
primary: Color(0xFF4C4F5E),
shape: CircleBorder(),
padding: EdgeInsets.all(15),
),);
}}