Search code examples
fluttersupabasesupabase-database

How to fetch data from supabase


I tried this by exploring web and supabase docs but nothing really happens

import 'package:supabase/supabase.dart';

class supahandelar {
  static const SupaUrl = 'UrlFromSupabase';
  static const SupaKey = 'KeyFromSupabase';

  final client = SupabaseClient(SupaUrl, SupaKey);
  getData() async {
    var response = await client.from('Pokemons').select().execute();
    print("Respnse");
    print(response);
    
  }
}

It gives me this output on console:

instance of 'minified:hy<erased>'

Also not getting any output in widgets/ui

Can anyone please suggest me simple methods to only fetch data.


Solution

  • It was just an RSL issues. When i tried with new databases without RSL disabled it worked.

    So i need to create RSL Policy of who to allow read data... For Ex:-I Added true for all user to read

    If anyone face this issue please check/ Create RSL Policy.