SettingsSyncController class
Settings sync service controller.
Syncs user settings and memory files between local disk and the Anthropic API backend. Supports both upload (interactive CLI) and download (CCR mode) patterns.
- Inheritance
-
- Object
- Listenable
- ListNotifier
- SintController
- SettingsSyncController
Constructors
-
SettingsSyncController({required bool isUsingOAuth(), required bool isInteractive(), required bool isUploadFeatureEnabled(), required bool isDownloadFeatureEnabled(), required bool isUploadGateEnabled(), required bool isDownloadGateEnabled(), required String getApiProvider(), required bool isFirstPartyBaseUrl(), required ({String? accessToken, List<
String> ? scopes})? getOAuthTokens(), required Future<void> checkAndRefreshOAuthToken(), required Future<String?> getRepoRemoteHash(), required Future<({Map< httpGet(String url, Map<String, dynamic> ? data, int statusCode})>String, String> headers), required Future<({Map< httpPut(String url, Object body, Map<String, dynamic> ? data, int statusCode})>String, String> headers), required String getUserAgent(), required String getBaseApiUrl(), required String getBetaHeader(), required String? getSettingsFilePath(String source), required String getMemoryPath(String scope), required Future<String?> readFileOrNull(String path), required Future<bool> writeFileSafe(String path, String content), required Future<int?> getFileSize(String path), required void resetSettingsCache(), required void clearMemoryFileCaches(), required void markInternalWrite(String path), required void logDiagnostics(String level, String event, [Map<String, Object?> ? data]), required void logEvent(String eventName, Map<String, Object?> metadata)})
Properties
-
checkAndRefreshOAuthToken
→ Future<
void> Function() -
Check and refresh OAuth token if needed.
final
- clearMemoryFileCaches → void Function()
-
Clear memory file caches.
final
- getApiProvider → String Function()
-
Get the API provider type.
final
- getBaseApiUrl → String Function()
-
Get base API URL for endpoint construction.
final
- getBetaHeader → String Function()
-
Get beta header for OAuth.
final
-
getFileSize
→ Future<
int?> Function(String path) -
Get file size in bytes.
final
- getMemoryPath → String Function(String scope)
-
Get memory file path for scope.
final
-
getOAuthTokens
→ ({String? accessToken, List<
String> ? scopes})? Function() -
Get OAuth tokens.
final
-
getRepoRemoteHash
→ Future<
String?> Function() -
Get git repo remote hash for project identification.
final
- getSettingsFilePath → String? Function(String source)
-
Get settings file path for a source key.
final
- getUserAgent → String Function()
-
Get user agent string.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
httpGet
→ Future<
({Map< Function(String url, Map<String, dynamic> ? data, int statusCode})>String, String> headers) -
HTTP GET.
final
-
httpPut
→ Future<
({Map< Function(String url, Object body, Map<String, dynamic> ? data, int statusCode})>String, String> headers) -
HTTP PUT.
final
- initialized → bool
-
Checks whether the controller has already been initialized.
no setterinherited
- isClosed → bool
-
Checks whether the controller has already been closed.
no setterinherited
- isDisposed → bool
-
no setterinherited
- isDownloadFeatureEnabled → bool Function()
-
Feature gate for download.
final
- isDownloadGateEnabled → bool Function()
-
GrowthBook cached feature value for download gate.
final
- isFirstPartyBaseUrl → bool Function()
-
Check if the base URL is first-party Anthropic.
final
- isInteractive → bool Function()
-
Whether the current session is interactive.
final
- isUploadFeatureEnabled → bool Function()
-
Feature gate for upload.
final
- isUploadGateEnabled → bool Function()
-
GrowthBook cached feature value for upload gate.
final
- isUsingOAuth → bool Function()
-
Whether the user is authenticated with first-party OAuth.
final
- listenersLength → int
-
no setterinherited
-
logDiagnostics
→ void Function(String level, String event, [Map<
String, Object?> ? data]) -
Diagnostics logger.
final
-
logEvent
→ void Function(String eventName, Map<
String, Object?> metadata) -
Analytics event logger.
final
- markInternalWrite → void Function(String path)
-
Mark a file write as internal (suppress change detection).
final
-
readFileOrNull
→ Future<
String?> Function(String path) -
Read a file. Returns null if not found.
final
- resetSettingsCache → void Function()
-
Reset settings cache after writing.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
writeFileSafe
→ Future<
bool> Function(String path, String content) -
Write a file (creates parent dirs).
final
Methods
-
addListener(
SintStateUpdate listener) → Disposer -
Register a closure to be called when the object notifies its listeners.
inherited
-
addListenerId(
Object? key, SintStateUpdate listener) → Disposer -
inherited
-
containsListener(
SintStateUpdate listener) → bool -
inherited
-
debounce<
T> (RxInterface< T> rx, void callback(T), {Duration duration = const Duration(milliseconds: 400)}) → void -
Calls
callbackafterrxstops changing forduration. Useful for search-as-you-type, form validation, etc.inherited -
dispose(
) → void -
inherited
-
downloadUserSettings(
) → Future< bool> - Download settings from remote for CCR mode. First call starts the fetch; subsequent calls join it.
-
ever<
T> (RxInterface< T> rx, void callback(T)) → void -
Calls
callbackevery timerxchanges. Auto-cancels on controller disposal.inherited -
interval<
T> (RxInterface< T> rx, void callback(T), {Duration duration = const Duration(seconds: 1)}) → void -
Calls
callbackat most once perduration, ignoring intermediate changes. Useful for rate-limiting UI updates.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
once<
T> (RxInterface< T> rx, void callback(T)) → void -
Calls
callbackonly the first timerxchanges, then cancels.inherited -
onClose(
) → void -
Called before onDelete method. onClose might be used to
dispose resources used by the controller. Like closing events,
or streams before the controller is destroyed.
Or dispose objects that can potentially create some memory leaks,
like TextEditingControllers, AnimationControllers.
Might be useful as well to persist some data on disk.
inherited
-
onDelete(
) → void -
inherited
-
onInit(
) → void -
Called immediately after the widget is allocated in memory.
You might use this to initialize something for the controller.
inherited
-
onReady(
) → void -
Called 1 frame after onInit(). It is the perfect place to enter
navigation events, like snackbar, dialogs, or a new route, or
async request.
inherited
-
onStart(
) → void -
Called at the exact moment the widget is allocated in memory.
It uses an internal "callable" type, to avoid any @overrides in subclasses.
This method should be internal and is required to define the
lifetime cycle of the subclass.
inherited
-
redownloadUserSettings(
) → Future< bool> - Force a fresh download, bypassing the cached startup promise.
-
refresh(
) → void -
inherited
-
refreshGroup(
Object id) → void -
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that the
object notifies.
inherited
-
removeListenerId(
Object id, VoidCallback listener) → void -
inherited
-
reportAdd(
VoidCallback disposer) → void -
inherited
-
reportRead(
) → void -
inherited
-
resetDownloadPromiseForTesting(
) → void - Reset the download promise (for testing).
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
[List< Object> ? ids, bool condition = true]) → void -
Notifies listeners to update the UI.
inherited
-
uploadUserSettingsInBackground(
) → Future< void> - Upload local settings to remote (interactive CLI only). Called from preAction. Runs in background — caller should not await.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited