LeDragunov
07/29/2021, 9:31 PMdart
class SupabaseConnection {
final _client = Supabase.instance.client;
Future supabaseQuery() async {
final selectResponse = await _client
.from('users')
.select()
// .order('name', ascending: true)
.eq('email', 'myemail@gmail.com')
.single()
.execute();
if (selectResponse.error == null) {
print('response.data: ${selectResponse.data}');
}
print(selectResponse.data);
}
}
with the following place in the main.dart
dart
Supabase.initialize(
url: kSupabaseUrl,
anonKey: kSupabaseKey,
// authCallbackUrlHostname: 'login-callback', // optional
debug: true // optional //todo: check if it should be removed once live
);
Kosh
07/29/2021, 9:32 PMLeDragunov
07/29/2021, 9:33 PMKosh
07/29/2021, 9:33 PMKosh
07/29/2021, 9:33 PMLeDragunov
07/29/2021, 9:33 PMLeDragunov
07/29/2021, 9:34 PMKosh
07/29/2021, 9:34 PMKosh
07/29/2021, 9:34 PMKosh
07/29/2021, 9:34 PMLeDragunov
07/29/2021, 9:34 PMLeDragunov
07/29/2021, 9:35 PMKosh
07/29/2021, 9:37 PMKosh
07/29/2021, 9:37 PMCREATE OR REPLACE FUNCTION public.email_exists(user_email text)
RETURNS boolean
LANGUAGE sql
SECURITY DEFINER
AS $$
EXISTS (select * from auth.users where email = user_email);
$$;
keep in mind this could result in some security issues.LeDragunov
07/29/2021, 9:39 PMKosh
07/29/2021, 9:40 PMKosh
07/29/2021, 9:41 PMLeDragunov
07/29/2021, 9:42 PMKosh
07/29/2021, 9:42 PMcreate trigger user_Created
after
insert
on auth.users FOR EACH ROW EXECUTE PROCEDURE on_user_created();
then on_user_created
can copy the data.Kosh
07/29/2021, 9:42 PMLeDragunov
07/29/2021, 9:43 PMKosh
07/29/2021, 9:43 PMKosh
07/29/2021, 9:43 PMKosh
07/29/2021, 9:43 PMLeDragunov
07/29/2021, 9:43 PMLeDragunov
07/29/2021, 9:44 PMbill92
04/09/2022, 11:45 PM