supabase 3.0.0-dev.16
supabase: ^3.0.0-dev.16 copied to clipboard
A dart client for Supabase. This client makes it simple for developers to build secure and scalable products.
Supabase Dart web example #
A bare-bones web app that queries, writes and listens to a countries table:
create table countries (
id bigint generated by default as identity primary key,
name text not null
);
-- Row level security keeps the publishable key from reaching the table beyond
-- what the policies allow. These let anyone read and change countries, which
-- suits a demo project only; scope them to signed in users in a real app.
alter table countries enable row level security;
create policy "Anyone can read countries"
on countries for select using (true);
create policy "Anyone can manage countries"
on countries for all using (true) with check (true);
-- Stream changes on the table to realtime subscribers.
alter publication supabase_realtime add table countries;
It reaches the table through the typed table API, client.table(Countries.table),
using the row, insert, update and column types in lib/supabase_schema.g.dart.
That file is generated from the database schema with the
Supabase CLI and the
supabase_typegen dev dependency. Generate it again from your own project after
every schema change:
supabase gen types --lang dart --schema public --remote=YOUR_PROJECT_REF > lib/supabase_schema.g.dart
The command needs Supabase CLI 3.0.0 or newer.
Examples
- Flutter user management: https://github.com/supabase/supabase/tree/master/examples/user-management/flutter-user-management
- Extended flutter user management with web support, github login, recovery password flow
- Spot, open source geo based video sharing social app created with Flutter
- Notes app: https://github.com/bigblackclock/supabase_notes