initialize static method

Future<Supabase> initialize({
  1. String? url,
  2. String? anonKey,
  3. String? authCallbackUrlHostname,
  4. bool? debug,
  5. LocalStorage? localStorage,
})

Initialize the current supabase instance

This must be called only once. If called more than once, an AssertionError is thrown

Implementation

static Future<Supabase> initialize({
  String? url,
  String? anonKey,
  String? authCallbackUrlHostname,
  bool? debug,
  LocalStorage? localStorage,
}) async {
  assert(
    !_instance._initialized,
    'This instance is already initialized',
  );
  if (url != null && anonKey != null) {
    _instance._init(url, anonKey);
    _instance._debugEnable = debug ?? kDebugMode;
    _instance.log('***** Supabase init completed $_instance');

    await SupabaseAuth.initialize(
      localStorage: localStorage ?? const HiveLocalStorage(),
      authCallbackUrlHostname: authCallbackUrlHostname,
    );
  }

  return _instance;
}