'setState on onPressed with null
I am new to flutter. I have copy this code from bluetooth serial package example and I want to add a setState.
FlatButton(
onPressed: isConnected ? () =>
_sendMessage('0') : null
)
This is what I already tried:
FlatButton(
onPressed:(){
if(isConnected)
_sendMessage('0');
setState(() {
counter=true;
});
}
)
But the state didnt change.
What is the correct way on adding setState on this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
