ensureCurrentSupabaseOAuthConfigForProject function

FFSupabaseConfig ensureCurrentSupabaseOAuthConfigForProject(
  1. FFProject project, {
  2. required String currentEnvironmentKey,
})

Ensures the current environment has an OAuth config entry.

WARNING: Because supabase_oauth_config and supabase_self_hosted_config share a protobuf oneof, calling this will silently clear any existing self-hosted config. Only call after the user has explicitly chosen OAuth.

Implementation

FFSupabaseConfig ensureCurrentSupabaseOAuthConfigForProject(
  FFProject project, {
  required String currentEnvironmentKey,
}) {
  final oauthConfigs = project.ensureBackend().ensureSupabaseOauthConfig()
      .oauthConfigs;
  return oauthConfigs.putIfAbsent(currentEnvironmentKey, FFSupabaseConfig.new);
}