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
- listRows result parsing issue
I'm using Appwrite Dart SDK "24.2.0". When I perform a listRows call in dart, I have this reponse in JSON: in " Future<models.RowList> listRows()" { "total" :...
- Broken Flutter SDK >=24.1.0
Row.fromMap now does: ``` data: Map<String, dynamic>.from(map["data"] ?? {}) ``` But Appwrite Cloud TablesDB row responses return custom row columns flattene...
- Flutter OAuth2 does not attach Google se...
Hi Appwrite team, I’m using Appwrite Auth in a Flutter mobile app and trying to upgrade an anonymous user to Google OAuth. Docs say that if there is already a...