I want to pass parameter from my dialouge box(Void function) to another void function but getting error
can't be assigned to the parameter type () void flutter
and setState also not working.
Please check my code here:
First function
void _quantity(BuildContext context, productId,quantity){
setState(() {
productId = productId;
quantity = quantity;
_quantityController.text = '$quantity';
});
var alert = new AlertDialog(
actions: <Widget>[
FlatButton(
child: Text("Save"),
onPressed: _addtoCart(context, productId)
)
],
);
showDialog(context: context,builder: (context) => alert);
}
Second Function:
void _addtoCart(BuildContext context, productId) {
print("Quantity: $quantity");
print("productId: $productId");
print("data: $data");
}
Please check screenshot here
