sure
Hello I have attached below all my code related to userProfiel realtime update, I have tried for several hours on my own and still cant find a solution. Please help
final appwriteRealtimeProvider = Provider((ref) { final client = ref.watch(appwriteClientProvider); return Realtime(client); }); // ------------------- Stream<RealtimeMessage> getLatestProfileData(); final userApiProvider = Provider((ref) { final db = ref.watch(appwriteDatabaseProvider); final realTime = ref.watch(appwriteRealtimeProvider); return UserApi(db: db, realtime: realTime); }); // -------------------- final getLatestUserProfileDataProvider = StreamProvider((ref) { final userApi = ref.watch(userApiProvider); return userApi.getLatestProfileData(); }); // ------------------------ import '../controller/user_profile_controller.dart'; import '../widget/user_profile.dart';
class UserProfileView extends ConsumerWidget { static route(UserModel userModel) => MaterialPageRoute( builder: (context) => UserProfileView(userModel: userModel), ); const UserProfileView({super.key, required this.userModel});
final UserModel userModel;
@override Widget build(BuildContext context, WidgetRef ref) { UserModel copyOfUser = userModel; return Scaffold( body: ref.watch(getLatestUserProfileDataProvider).when( data: (data) { if (data.events.contains( 'databases.*.collections.${AppwriteConstants.usersCollection}.documents.${userModel.uid}.update')) { copyOfUser = UserModel.fromMap(data.payload); return UserProfile(userModel: copyOfUser); } return UserProfile(userModel: copyOfUser); }, error: (error, stackTrace) => ErrorText(error: error.toString()), loading: () { return UserProfile(userModel: copyOfUser); // return Loader(); }, ), ); } }
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Also...what exactly is wrong? What do you expect is happening vs the actual behavior?
When I update my profile and and profile picture I expect it to reflect on the ui, it only happends when i restartt my app
Where are you calling subscribe?
Aahhh!!! I am not sure where to do that
š¬
I will aditionally add my link to repo, https://github.com/nuaiman/flutter_appwrite_twitter_clone
Ref.when() is probably not the right approach, unless you change up the ref.
As mentioned in the docs, you have to subscribe and then listen to the stream: https://appwrite.io/docs/realtime
Ohhhh
I still dont understand, what to write
Look at how the subscription is created and used
Okay, i will have a look at it and report back
@Steven hello
I am stuck in a situation
I dont know what to write for a particular realTime
let me exlain
``
'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatsCollection}.documents.'
I want to only get realtime document where the conversationId is matching with me
@Binyamin
please don't randomly tag people as it can be disruptive
you'll have to filter this client side.
You might want to šš¼ this issue: https://github.com/appwrite/appwrite/issues/2490
Recommended threads
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...
- 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...