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
- Current User is Not authorized
recreating same Thread
- 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...