I have a bool called isSubmited. Default value is false. I want to change the value when user click on a button but the fact is how can I do it without the setState method in flutter. I just want to change the value not the user interface. I just want change the bool value nothing else. But not the app state itself!
CodePudding user response:
just change the value without wrapping it with setState.
isSubmitted = false;
CodePudding user response:
you can use hive cache so set/get your boolean value ( or any other value bool, String, anytime in your app without changing user interface
Example :
var box = Hive.box('myBox');
box.put('isSubmited', true);
bool isSubmited = box.get('isSubmited');
CodePudding user response:
you can update the bool value without setState method. if you are not updating the state on the app based on "isSubmited" value then you don't need to setState. just assign it like this
onPressed:(){
isSubmitted=true;
}