Answers for "flutter use valuechanged function in function"

1

flutter use valuechanged function in function

class 1{
  //in the class where you need to use the callback declare as field
  Function(String value) onChanged,

  //then use the function as inChanged callback eventually adding code
  TextField(
    onChanged: (value){
        onChanged(value);
        state.didChange(value);
    },
  )
}

//in the other class pass the function like this
class 2{
	new 1({
    	...
        onChanged: (value) {
        	restaurant.name = value;
        },
        ...
    });
}
Posted by: Guest on November-17-2020

Code answers related to "flutter use valuechanged function in function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language