SupabaseClient constructor

SupabaseClient(
  1. String supabaseUrl,
  2. String supabaseKey, {
  3. String? schema,
  4. bool autoRefreshToken = true,
  5. Map<String, String> headers = Constants.defaultHeaders,
})

Implementation

SupabaseClient(
  this.supabaseUrl,
  this.supabaseKey, {
  String? schema,
  bool autoRefreshToken = true,
  Map<String, String> headers = Constants.defaultHeaders,
})  : restUrl = '$supabaseUrl/rest/v1',
      realtimeUrl = '$supabaseUrl/realtime/v1'.replaceAll('http', 'ws'),
      authUrl = '$supabaseUrl/auth/v1',
      storageUrl = '$supabaseUrl/storage/v1',
      functionsUrl = RegExp(r'(supabase\.co)|(supabase\.in)')
              .hasMatch(supabaseUrl)
          ? '${supabaseUrl.split('.')[0]}.functions.${supabaseUrl.split('.')[1]}.${supabaseUrl.split('.')[2]}'
          : '$supabaseUrl/functions/v1',
      schema = schema ?? 'public',
      _headers = headers {
  auth = _initSupabaseAuthClient(
    autoRefreshToken: autoRefreshToken,
    headers: headers,
  );
  realtime = _initRealtimeClient(headers: headers);

  _listenForAuthEvents();
}