Stream not updating value. I am using the below stream to get the value and update when user value is null. Everytime it's returning 0. eventhough it has value. please help.
I can't use setstate() since it's a repository of queries.
int? ispublisher = 0;
userRepository.getUser(userKey: userKey!).forEach((users) {
print(users);
if (users != null) {
isPublisher = users.publisher;
},
});
print(publisher);