UserAiSettingsDatasource class Data Sources

Reads/writes per-user AI provider settings on Supabase. Source of truth for the API key, model, and auth mode the user has chosen — used by AiSettingsScreen alongside FlutterSecureStorage (which acts as a write-through local cache).

Constructors

UserAiSettingsDatasource(SupabaseClient _client)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear(AiProvider provider) Future<void>
Delete the row for (currentUser, provider). No-op if it doesn't exist.
get(AiProvider provider) Future<UserAiSettingsModel?>
Fetch the row for (currentUser, provider). Returns null if no row exists or the user isn't signed in.
getAllForCurrentUser() Future<List<UserAiSettingsModel>>
Fetch all providers' rows for the current user. Used by the post-auth hydration provider to warm the local cache for every provider in one round-trip.
hasConsent() Future<bool>
Whether the user has accepted the cloud-sync disclaimer at any version. Returns false on transient network errors so the caller treats absence of consent as "not yet consented" — the screen will re-prompt next save.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recordConsent(String version) Future<void>
Record the user's acceptance of the cloud-sync disclaimer at version.
toString() String
A string representation of this object.
inherited
upsert({required AiProvider provider, String? apiKey, String? model, AiAuthMode authMode = AiAuthMode.apiKey, String? oauthTokenId}) Future<void>
Upsert a row for (currentUser, provider). Caller is responsible for having recorded consent first via recordConsent.

Operators

operator ==(Object other) bool
The equality operator.
inherited