Skip to content

listen to notification #147

@saqib556612

Description

@saqib556612

Hello i am using postgress on cloud and i created triggerfunction and trigger in pgAdmin.
Here is my trigger function

CREATE FUNCTION public.row_notifiy_n()
RETURNS trigger
LANGUAGE 'plpgsql'
COST 100
VOLATILE NOT LEAKPROOF
AS $BODY$
BEGIN
PERFORM pg_notify(
'rowChanged',
json_build_object(
'operation', TG_OP,
'record', row_to_json(new)
)::text
);
Return new;
END;
$BODY$;

ALTER FUNCTION public.row_notifiy_n()
OWNER TO "abc";

and trigger is

CREATE TRIGGER notify
AFTER INSERT OR DELETE OR UPDATE
ON public."Logs"
FOR EACH ROW
EXECUTE PROCEDURE public.row_notifiy_n();

ALTER TABLE public."Logs"
ENABLE ALWAYS TRIGGER notify;

How i can listen this in flutter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions