This is my first time using supabase realtime, I want to access values in my table in real time and also update them with interactrions from the app. I prepopulated the database in supabase but when I tried to retrieve the data it was empty.
I have attached a picture with the current database setup.
class _TrackerState extends State<Tracker> {
@override
Widget build(BuildContext context) {
final SupabaseClient supabase = Supabase.instance.client;
final stream = supabase.from('Counter').stream(primaryKey: ["name"]);
return Scaffold(
appBar: ...
),
body: Center(
child: StreamBuilder(
stream: stream,
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.active:
if (snapshot.hasError) log(snapshot.error.toString());
log(snapshot.data.toString());
final data = snapshot.data as List<dynamic>;
return ...
default:
return const Scaffold(
body: Center(
child: SizedBox(
child: CircularProgressIndicator(),
),
));
}
},
),
),
);
}
}
console output: [log] []
streamatinitmethod.