I followed all steps in documentation, but this function never gets called:
subscription.on(LiveQueryEvent.create,
(value) {});
All I receive in terminal is this: "ReSubScription:{}".
I am trying to capture the event when one of my classes in the database gets a new record/entry.
If requested, I can arrange a demo codebase, but please help me get through this.
PS: I am calling this subscription.on() method in initState() method of a stateful widget, not in main().
UPDATE
I am sharing link of git repo of a minimal app to demonstrate what I did. Here is the link
Please see what have I done incorrect with livequery. Would be grateful for any pointers/guidance.
UPDATE 2nd
Please note, I've hardcoded adminId (objectId of admin logged in). Check TODO plz.
My Testing procedure:
- Create a user from backend database manually using Parse Dashboard. Plz Keep username = email.
- Open app. Click admin button. Go to AdminLogin page and enter your email and password.
- If you are successful, app will navigate to next white screen. This confirms that auth was done successfully.
- Open the app again. Click user button. Go to UserForm.
- Enter name and hit subscriber button. This will create a new class in Database by the name "Subscribers" and add columns "adminId" and "name" (plz hardcode the adminId in code bcoz you already know it)
- Now open the app again and go to admin and login again to move to control panel (white screen).
- Wait for the back4app to send trigger/callback. (which shows ReSubScription:{}).