0

I have a tables in my supabase database called properties, profile and saved.

The schema for the tables looks like this:

properties
  id int8 (pk),
  created_at timestamptz,
  description text,
  price text,
  address text,
profiles
  id uuid (pk),
  updated_at timestamptz,
  username text,
  email text,
saved
  id uuid (pk),
  created_at timestamptz,
  userid uuid (fk) references id from profile,
  propertyid int8 fk) references id from properties 

I created a CustomLikeButton in the below like_button.dart

import 'package:flutter/material.dart';

class CustomLikeButton extends StatelessWidget {
  final bool isLiked;
  void Function()? onTap;
  CustomLikeButton({super.key, required this.onTap, required this.isLiked});

  @override 
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Icon(
        isLiked ? Icons.favorite : Icons.favorite_border,
        color: isLiked ? Colors.red : Colors.grey,
      )
    );
  }

}

I'm having trouble creating functions that can query the saved table, insert rows into the query table and also delete rows from the query table whenever a property listing is liked or unliked. Any help especially tried and tested will be helpful

1 Answer 1

-1

Have you tried Postgres Functions and RPC?

Sign up to request clarification or add additional context in comments.

1 Comment

I have but it doesn't seem to work. There's something wrong with the functions I have in my code but I don't know what it is

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.