Issue
I am using ChangeNotifier and i change their value and notify like below,
// Declare
ValueNotifier<bool> isDisplay = new ValueNotifier(false);
// Change value
isDisplay.value = false;
isDisplay.notifyListeners();
It’s working fine. but it’s raise warning like below,
Can we resolve this using proper implementation or other things ?
Solution
You do not need to call notifyListeners
, as this is automatically called when a new value is set.
ChangeNotifier
implementations like ValueListener
should never require notifyListeners
to be called manually.
Answered By – hacker1024
Answer Checked By – Mary Flores (FlutterFixes Volunteer)