onPressed property

dynamic Function()? onPressed
final

onPressed is used to set the button action This is an optional property This is a function type property

Example:

CustomButton(
label: 'Login',
onPressed: () {
print('Login');
},
);

Implementation

final Function()? onPressed;