I'm unfortunately out of ideas for now. I sugges you wait for someone else to respond 😅
yeah anyways thanks for responding
can you please share your project linkg (if possible) please?
he followed this videos - https://youtu.be/XnxZLhtkFeg
most of the people getting this problem only in user profile realtime not in user posts realtime
Can you try to make sure to subscribe only after making sure you're authenticated and also use a separate realtime instance for each subscription
i will try the second suggestion
and by authentication,you mean to check weather the currentUser==null or not?
After you call account.get() successfully
yeah thats done initially for the whole app
Yes, but just make sure you subscribe after that
isnt that already ensured when i have a valid session going on or after i have logged in successfully?
making different instance ain't working either
It depends on how your app is set up
yeah in my app its ensured but the problem is still there .....however i am unable to understand how realtime works at one place flawlessly but on another screen its showing subscription:null message
And you're using a separate realtime instance? What's your new code?
we are building the same project and i think he has tried it and its not working
In API i used final Realtime _realtimes;
whereas I used this - final Realtime _realtime;
in user posts and here is my API function accordingly - @override
Stream<RealtimeMessage> getLatestUserprofileData() {
return _realtimes.subscribe([
'databases.${AppConstants.APPWRITE_DATABASE_ID}.collections.${AppConstants.APPWRITE_USERS_COLLECIION}.documents'
]).stream;
}
provider - final getLatestUserProfileDataProvider = StreamProvider((ref) {
final userAPI = ref.watch(userAPIProvider);
return userAPI.getLatestUserprofileData();
});
UI page - currentUser == null
? const Loader()
: SafeArea(
child: Scaffold(
body: ref.watch(getLatestUserProfileDataProvider).when(
data: (data) {
if (data.events.contains(
'databases.*.collections.${AppConstants.APPWRITE_USERS_COLLECIION}.documents.${copyOfUser.uid}.update',
)) {
copyOfUser = UserModel.fromMap(data.payload);
}
return UserProfile(user: copyOfUser);
},
error: (error, st) => ErrorText(
error: error.toString(),
),
loading: () {
return UserProfile(user: copyOfUser);
},
),
),
);
here currentUser is a provider for account.get()
wait wait it is working now
make another provider for it - final apppwriteRealtimeProvider = Provider((ref) {
final client = ref.watch(appwriteClientProvider);
return Realtime(client);
});
- provider for user posts
final client = ref.watch(appwriteClientProvider);
return Realtime(client);
});``` - provider for userprofile and don't forget to use this provider in userApiProvider
and then make another instance like i shared above
it will start working then
thanks @Steven
thanks @Steven mine also worked🤩
[SOLVED] Realtime Subscription Null
Recommended threads
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- [SOLVED] OAuth With Google & Flutter
Hi all, I'm trying to sign in with google and it all goes swimmingly until the call back. I get a new user created on the appwrite dashboard however the flutte...