You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to auto reset the value of Provider ?? This is the ,measure issue i find on Provider, Can you please suggest me how to handle reset all value inside TestProvider without create method manually to reset any value??
#880
Open
DeepakYiron opened this issue
Jun 27, 2024
· 0 comments
See Here is isChecked =false by-default
i Navigate to this screen from some other screen and changed the state of checkbox (now its true)
Now My concern is if go back to previous screen and then re enter in this checkbox screen then i found the checkbox value is true.
how can i reset the the provider all value when screen is no more needed and disposed.
I have tried the solution with creating a method to reset value , but thats not the right approach to reset manually.
Please suggest me how to handle this senario,
its just a example of one checkbox. but in my app there are 100s of fields and i am going to reset all manually.
The text was updated successfully, but these errors were encountered:
I just create a provider with one bool var which is used to check and uncheck the checkbox widget state.
class TestProvider extends ChangeNotifier {
bool isChecked=false;
onChangeCheckBoxVal(val){
isChecked=val;
notifyListeners();
}
}
Here is my code of UI
Consumer(builder: (context, provider, child){
return Checkbox(value: provider.isChecked, onChanged: (val){
provider.onChangeCheckBoxVal(val);
}),
})
See Here is isChecked =false by-default
i Navigate to this screen from some other screen and changed the state of checkbox (now its true)
Now My concern is if go back to previous screen and then re enter in this checkbox screen then i found the checkbox value is true.
how can i reset the the provider all value when screen is no more needed and disposed.
I have tried the solution with creating a method to reset value , but thats not the right approach to reset manually.
Please suggest me how to handle this senario,
its just a example of one checkbox. but in my app there are 100s of fields and i am going to reset all manually.
The text was updated successfully, but these errors were encountered: