Search code examples
fluttersupabasesupabase-databasesupabase-flutter

Issue with Supabase Flutter Integration: Unable to Update Row


I am currently working on a Flutter application that utilizes Supabase as its backend. I have encountered an issue where Supabase is not updating a specific row in my database.

Below is the relevant code snippet from my Flutter application:

import 'package:flutter/material.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

class Debug extends StatelessWidget {
  const Debug({Key? key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: FilledButton(
          child: const Text("Debug"),
          onPressed: () {
            try {
              Supabase.instance.client
                  .from('transponder')
                  .update({'person': 3}).eq('id', 2);
            } catch (error) {
              print(error);
            }
          },
        ),
      ),
    );
  }
}

Here's an overview of my database schema:

  • transponder(id, name, code, person)
  • person(id, username, admin)
  • checkin(id, created_at, person, transponder)

I have ensured that there are constraints between the necessary objects, and I have disabled RLS (Row-Level Security) on all tables.

Despite these precautions, the row update operation does not seem to take effect. I would appreciate any insights or suggestions on what might be causing this issue and how it can be resolved.

Thank you in advance!


Solution

  • You need to await the calls.

    await Supabase.instance.client
      .from('transponder')
      .update({'person': 3}).eq('id', 2);