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
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support π I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...
- context deadline exceeded
Hi, in one of my projects i continuously receive context deadline exceeded when trying to reach users API from my local machine: https://fra.cloud.appwrite.io/v...
- π Realtime Flutter SDK Crash β Realtime...
**Summary** When using Appwrite Cloud with the Flutter SDK (latest appwrite release: 21.4.0), Realtime crashes with: ```Unhandled async error: type '_Map<String...