In this post - https://discordapp.com/channels/564160730845151244/1116298067050774568
I was having a problem related to getting my posts appear in real time on homepage and when i made sure that the user id is not null then it started working but now when i open my comment section(where i tried to implement the same) i get this on my debug console - I/flutter (26502): subscription: null and it stops working in post, comment and on other pages -
here is my comments page -
return currentUser == null
? const Loader()
: Scaffold(
body: Column(
children: [
BlogCard(blog: blog),
ref.watch(getReplyToBlogsProvider(blog)).when(
data: (comments) {
return
ref.watch(getLastestReplytoBlogsProvider).when(
data: (data) {
if (data.events.contains(
'databases.*.collections.${AppConstants.APPWRITE_COMMENTS_COLLECTION}.documents.*.create'
)) {
comments.insert(0, Comments.fromMap(data.payload));
}
return Expanded(
child: ListView.builder(
itemCount: comments.length,
itemBuilder: (BuildContext context, int index) {
final comment = comments[index];
return CommentCard(comment: comment);
}),
);
},
error: (error, StackTrace) =>
ErrorText(error: error.toString()),
loading: () {
return Expanded(
child: ListView.builder(
itemCount: comments.length,
itemBuilder: (BuildContext context, int index) {
final comment = comments[index];
return CommentCard(comment: comment);
}),);});},
error: (error, StackTrace) => ErrorText(error: error.toString()),
loading: () => const Loader()),
],),
bottomNavigationBar: TextField(onSubmitted: (value) {ref.read(CommentsControllerProvider.notifier).shareComment(text: value, context: context, BlogID: blog.id, currentUser: currentUser);
},),);```
realtime provider -
final BlogAPI = ref.watch(blogAPIProvider);
return BlogAPI.getLatestReplytoBlogs();
});```
api function -
``` @override
Stream<RealtimeMessage> getLatestReplytoBlogs() {
return _realtime.subscribe([
'databases.${AppConstants.APPWRITE_DATABASE_ID}.collections.${AppConstants.APPWRITE_COMMENTS_COLLECTION}.documents'
]).stream;
}```
(used currentUser provider to make sure if the user is not null[same as i used in post and it started working])
can you try without putting Realtime in a provider?
Recommended threads
- Fine grained permissions for webRTC hand...
Hi, I am building a WebRTC P2P app for a university project and have hit a security limitation regarding permissions for anonymous users. The Architecture: We ...
- Synchronous Function Execution Timed Out...
Hi Appwrite team 👋 I’m facing a synchronous function execution timeout issue on Appwrite Cloud and would appreciate some guidance. I executed this function u...
- Realtime not working for some tables
Hi, I've got an issue where I can setup a realtime connection to listen to some tables, but some not all. I have two tables `history` and `users`. Both can be ...