Answers for "flutter pass onPress function as parameter"

0

flutter pass onPress function as parameter

int  result = 0;

    void calculate(num1, num2) {
     setState(() {
         result = num1 + num2;
     });
    }


    new RaisedButton(
          onPressed: () => calculate(1, 100),
          ...
    ),
    new Text("$result")
Posted by: Guest on July-19-2021
0

flutter pass onPress function as parameter

void addition(int value1, int value2) {
    value1 + value2
}

IconButton(icon: Icon(Icons.add), onPressed: ()=>addition(2, 4))
Posted by: Guest on July-19-2021

Code answers related to "flutter pass onPress function as parameter"

Browse Popular Code Answers by Language