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
- `type 'Null' is not a subtype of type 'b...
When creating a new file using Appwrite Flutter SDK, the file is successfully created on the server, but the client throws the following exception: ``` type ...
- login With OAuth Failed
login With OAuth Failed: when i cliick to login with any of the following (facebook, gmail or apple) am being redirected out of the app to enter my detail, afte...
- RealtimeResponseEvent Typescript Bug
Hello, could you please fix RealtimeResposneEvent, the one in realtime.ts have timestamp: string, but the one in client.ts have timestamp: number, and it causes...