Please check the two samples below.
- The first sample does not rebuild the Widgets [Possibly 'listeners' are not being 'notified']
- The second sample works as expected
To my understanding, i think all these two should work. Can someone brief me on the comprehension I'm lacking? Thanks in advance.
Sample one (Does not rebuild) [ui changes do not take effect ]
onTap: (String? newValue) {
ref.watch(UserProvider).selectedMaritalStatusValue = newValue!;
UserModel().notifyAllListeners(); //triggers notifyListeners
},
Sample Two (Does rebuild)[working fine]
onTap: (String? newValue) {
ref.watch(UserProvider).setMaritalStatus(newValue!); // 'setMaritalStatus' has notifyListeners trigger within
},