
I have this code that is called inside the init
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
initialization(context);
_realtimeSynchronisation();
});
}```
**_realtimeSynchronisation**
```_realtimeSynchronisation() {
print('SYNC CALLED');
ref.watch(getLatestChatMsgProvider).when(
data: (data) {
final message = MessageAppwrite.fromJson(data.payload);
final document = Document.fromMap(data.payload);
var event = '';
if (data.events.contains('databases.*.collections.${Strings.collectionMessagesId}.documents.*.create')) {
event = 'create';
} else if (data.events.contains('databases.*.collections.${Strings.collectionMessagesId}.documents.*.delete')) {
event = 'delete';
} else if (data.events.contains('databases.*.collections.${Strings.collectionMessagesId}.documents.*.update')) {
event = 'update';
} else {
event = 'loading';
}
print('outer income');
if ((message.senderUserId == myUserId || message.receiverUserId == myUserId) && (message.senderUserId == friendUserId || message.receiverUserId == friendUserId)) {
print('incomes here');
print('Message Sent is ${message.message}');
print('Event $event');
messageNotifier?.saveMessage(message, document, event);
}
},
error: (error, stk) => ErrorText(error: error.toString()),
loading: () => print('SYNC CALLED how'),
);
setState(() {});
}```
Everything is working but it's not showing up in view

What’s not showing up where?

i want to update my view

if i call the _realtimeSynchronisation() function inside the build() function, it will trigger the realtime functions multiple time

so i thought initialising it inside the initState would be better

So what is working, and what isn’t?

if i make a call to the _realtimeSynchronisation() the flutter view will be updated but the issues is that it will be called multiple time
Recommended threads
- Realtime integration with SSR auth
Hey, I have a nextjs website with SSR auth, works great. I use a session client for user verification and an admin client with API key. Both is used with node-...
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
