You can initialize Supabase with the static initialize() method of the Supabase class.
The Supabase client is your entrypoint to the rest of the Supabase functionality and is the easiest way to interact with everything we offer within the Supabase ecosystem.
The unique Supabase URL which is supplied when you create a new project in your project dashboard.
The publishable (anon) key supplied when you create a new project in your project dashboard. Use this for client-side apps. The deprecated `anonKey` parameter is still accepted but `publishableKey` takes precedence when both are supplied.
Custom header to be passed to the Supabase client.
Custom http client to be used by the Supabase client.
Options to change the Auth behaviors.
Options to change the Postgrest behaviors.
Options to change the Realtime behaviors.
Options to change the Storage behaviors.
Future<void> main() async {
await Supabase.initialize(
url: 'https://xyzcompany.supabase.co',
publishableKey: 'your-publishable-key',
);
runApp(MyApp());
}
// Get a reference your Supabase client
final supabase = Supabase.instance.client;
final supabase = SupabaseClient(
'https://xyzcompany.supabase.co',
'your-secret-key', // use your secret key for server-side usage
);