skip to Main Content

I have a test project a Supabase website with these 2 tables :

enter image description here

and this is my main file :

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

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Supabase.initialize(
    url: 'https://fszmicgacuftwaxzrydi.supabase.co',
    anonKey:
        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImZzem1pY2dhY3VmdHdheHpyeWRpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTQ4MDY0MzIsImV4cCI6MjAzMDM4MjQzMn0.BhjbhjnuuIcFDZwtUF7FWehbna7KSrChm_s7UAJpRLdukvtko',
  );

  runApp(MyApp());
}

final supabase = Supabase.instance.client;

class MyApp extends StatelessWidget {
  MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Supabase Places Test')),
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              final data = await supabase.from('places').select();

              print(data);
            },
            child: const Text('Fetch Data'),
          ),
        ),
      ),
    );
  }
}

key and url are correct , but i cant get the data , is there any problem here?

2

Answers


  1. Chosen as BEST ANSWER

    I had to disabled the RLS security of the table


  2. Please Disable RLS Security of Supabase To Fetch All Data. I Hope this comment will Helpful.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search