What is your code?
TL;DR
User is experiencing an issue with updating stateNotifier when realtime data arrives. The error suggests that the provider cannot be modified in a build function. The user's code includes a stream provider and a method to get the latest message using realtime data. Another user asks for the user's code.Just a moment
@Steven
Stream<RealtimeMessage> getLatestMessage();
TypeScript
Stream<RealtimeMessage> getLatestMessage() {
final realtime = _realtime.subscribe([
'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.messagesCollection}.documents'
]).stream;
return realtime;
}
final getLatestMessageProvider = StreamProvider((ref) { final chatApi = ref.watch(chatsApiProvider); return chatApi.getLatestMessage(); });
As the error says, you can't modify the provider in a build function
The error even gives you suggestions for what to do
Thankyou
Recommended threads
- Server Down
Appwrite services are down. When will they start working again?
- My cloud functions failing 3 days ago (P...
Hi, My cloud function using python has been failing for 3 days, I didn't push any new deployments... Its something to do with it not recognising the entrypoi...
- Function was working: Failed to load ent...
I had a Bun function deployed two months ago working until 2 days ago on a daily basis, now I'm getting: Failed to load entrypoint, file src/main.js does not ex...