koolbase_flutter library

Classes

AppleFullName
Apple's optional full-name structure returned only on a user's FIRST Sign in with Apple. Both fields nullable; subsequent sign-ins omit this entirely.
AuthSession
BundleAssets
BundleManifest
BundlePayload
BundleRef
CheckResponse
ConflictResolver
Resolves conflicts by id.
FiscalIntentResult
The result of a fiscal submission or status poll.
FlowResult
FunctionInvokeResult
The result of a function invocation.
InMemoryAuthStorage
In-memory storage for tests. Holds a session for the life of the object and forgets it after; never touches the keychain. Also what Koolbase.initializeForTesting uses, so an auth gate can restore to signed-out and render its children without a platform channel.
Koolbase
The main Koolbase SDK client.
KoolbaseAggregate
One aggregation request.
KoolbaseAggregateAccounting
KoolbaseAggregateFilter
KoolbaseAggregateGroup
KoolbaseAggregateResult
The whole answer, including what could not be counted.
KoolbaseAuditEvent
One thing that happened to this account.
KoolbaseAuditPage
A page of audit events, and how many there are in total.
KoolbaseAuthClient
KoolbaseAuthGate
Branches the widget tree on authentication state, correctly.
KoolbaseAuthScope
Auth state for descendants of a KoolbaseAuthGate.
KoolbaseAuthStorage
Abstract storage interface for persisting authentication state.
KoolbaseBatchOp
One operation in an atomic KoolbaseDatabaseClient.batch.
KoolbaseBatchResult
The result of one operation in a KoolbaseDatabaseClient.batch, in order.
KoolbaseBucket
KoolbaseCodePushClient
KoolbaseCodePushScope
KoolbaseCollection
KoolbaseCollectionController
The data half of KoolbaseCollectionList, deliberately widget-free.
KoolbaseCollectionGrid
A collection rendered as a grid rather than a list.
KoolbaseCollectionList
An opinionated list over a Koolbase collection.
KoolbaseConfig
Configuration for the Koolbase SDK.
KoolbaseConflict
A queued offline write the server would not apply, because the record changed between the change being made and the queue reaching it.
KoolbaseDatabaseClient
KoolbaseDocRef
Document reference for single record operations
KoolbaseDynamicScreen
KoolbaseError
A normalized SDK failure.
KoolbaseFiscalClient
Client for Koolbase Fiscal — authority-grade sales recording with jurisdiction adapters (Ghana GRA E-VAT live; kb-ref reference adapter everywhere).
KoolbaseFlag
A single feature flag rule. SDK evaluates: stableHash(deviceId + ":" + flagKey) % 100 < rolloutPercentage
KoolbaseFunctionsClient
Client for invoking Koolbase Functions from Flutter.
KoolbaseGroupBy
The category axis: a field's value, or a calendar bucket of a timestamp field.
KoolbaseImageTransform
Image-transformation options for KoolbaseStorageClient.publicUrl and KoolbaseObject.publicUrl. Each field maps to one Cloudflare Image Transformations parameter; unset fields are omitted.
KoolbaseMeasure
One number per group.
KoolbaseMessage
KoolbaseMessaging
KoolbaseNavigatorObserver
KoolbaseObject
KoolbaseObjectVersion
One entry in an object's version timeline. Covers both the current row (when isCurrent is true) and every history row, including soft-delete markers (isDeleteMarker true, size 0, no fetchable bytes). Returned from KoolbaseStorageClient.listVersions and KoolbaseStorageClient.getVersion; the underlying bytes are downloadable via KoolbaseStorageClient.getDownloadUrl with the versionId argument.
KoolbasePayload
The full bootstrap payload returned by the Koolbase API.
KoolbaseQuery
Fluent query builder for a collection
KoolbaseRealtimeClient
Koolbase realtime: one connection for the whole app, shared by every collection followed through on.
KoolbaseRecord
KoolbaseRecordController
The data half of KoolbaseRecordView, deliberately widget-free: one record of a collection, by id. The one-record twin of KoolbaseCollectionController, with the same rules:
KoolbaseRecordView
One record of a collection, by id, handed to builder -- a SCOPE, not a screen: it adds no scrolling and no layout of its own. The widget builder returns is the caller's, and everything inside it reads the record it was given, as a list row's children read theirs. Loading, not-found and error are slotted.
KoolbaseRfwWidget
KoolbaseSemanticHit
One ranked hit from a semantic search. record carries the full record (same wire shape as a record returned by query/get), and distance is the cosine distance between the query vector and the stored vector — lower means more similar. Range: 0 (identical direction) to 2 (opposite direction).
KoolbaseSemanticSearchResult
Result of KoolbaseQuery.searchSemantic. hits is the ranked list of nearest neighbors (best match first); total is the count of hits returned (matches hits.length in v1 — preserved as a separate field for future pagination).
KoolbaseSessionInfo
One active session — somewhere the user is signed in.
KoolbaseStorageClient
KoolbaseUpsertResult
Result of an upsert: the resulting record, and whether it was newly created (true) or an existing record was updated (false).
KoolbaseUser
KoolbaseVector
A stored vector retrieved by KoolbaseDocRef.getVector. The vector field carries the float values exactly as stored on the server, and the field-name + record-id pair identifies which slot they came from.
KoolbaseVersionPolicy
Version policy for forced/soft update enforcement.
KoolbaseVmPatchClient
System B (VM-level) code-push client — companion to KoolbaseCodePushClient (System A runtime bundles). This one ships compiled-Dart patches: it checks the resolver for a patch matching the running binary, downloads the signed .kbpatch, and stages it where the patched Flutter engine reads it at the NEXT cold launch. The engine verifies (Ed25519 + build_id) and applies before any Dart runs, then renames the staged file to mark it applied; on the following launch this client reconciles that into the persisted current_patch.
MandatoryUpdateInfo
Passed to KoolbaseConfig.onMandatoryUpdate when a mandatory bundle has been staged and is awaiting application on the next cold launch.
MfaEnrollment
What enrolling an authenticator returns: show otpauthUri as a QR code, and secret for people who type it in instead. Not retrievable again.
MfaStatus
OtpSendResult
Result of KoolbaseAuthClient.sendOtp — exposes the OTP expiry timestamp so apps can show a "resend in N seconds" countdown.
PendingWrite
A change made offline, waiting to be sent.
PhoneVerifyResult
Result of KoolbaseAuthClient.verifyOtp — wraps the issued AuthSession with isNewUser so apps can route first-time users to onboarding.
QueryResult
RealtimeConnection
One open realtime connection, as the client uses it: what arrives, how to send, how to close. The client opens it through a RealtimeConnector, so its lifecycle can be tested without a server.
RealtimeEvent
RecoveryCodeSignInResult
Signing in with a recovery code. When recoveryCodesRemaining reaches zero, prompt the person to regenerate a set.
ResendVerificationResult
Result of KoolbaseAuthClient.resendVerificationEmail.
RuntimeOverrideEngine
Merges a bundle payload into the runtime. Called synchronously before the first frame renders.
SignUpResult
Result of KoolbaseAuthClient.signUp.
UploadResult
VersionCheckResult

Enums

ConflictOperation
What the user was trying to do when the write was refused. insert since unique constraints made insert-conflicts real: a queued insert refused as a duplicate is held like any other terminal refusal. Resolving one IS the insert, retried — resolveWithMerge carries amended data (the "fix the colliding title" path); resolveWithServer means the colliding row stands, and clears without a request.
ConflictReason
Why a write is waiting for a decision.
FiscalStatus
The lifecycle status of a fiscal intent.
FunctionRuntime
Supported function runtimes.
KoolbaseAuthStatus
The auth states a running app can be in, as the gate models them.
KoolbaseErrorCode
What kind of failure occurred, in terms an application can act on.
KoolbaseImageFit
Resize mode when both KoolbaseImageTransform.width and KoolbaseImageTransform.height are specified. Maps 1:1 to Cloudflare's fit parameter.
KoolbaseImageFormat
Output format for image transformations served via Cloudflare's /cdn-cgi/image/ URL prefix. auto negotiates the best modern format (typically webp or avif) based on the requesting browser's Accept header; pin an explicit format only when you need deterministic output.
KoolbaseImageGravity
Anchor point when cropping. Use with KoolbaseImageFit.cover or KoolbaseImageFit.crop. auto runs Cloudflare's saliency detection; the others fix the anchor explicitly.
KoolbaseListStatus
The phases a collection load moves through, as the controller models them.
KoolbaseRecordStatus
The phases a one-record load moves through.
KoolbaseSearchMode
Retrieval strategy for KoolbaseCollectionQuery.searchSemantic.
RealtimeEventType
RestoreResult
Result of KoolbaseAuthClient.restoreSession.
VersionStatus
Result of a version check.

Functions

debugClearStreamRefreshers() → void
Clears the registry between tests. It lives for the process, so without this one test's registrations leak into the next.
debugRegisterStreamRefresher(String key, Future<void> refresh()) → void
Registers a refresher directly.
functionInvokeError(int statusCode, String message) → KoolbaseException
Builds the right exception for a failed invocation.
koolbaseDataError(int statusCode, Map<String, dynamic> body, {String fallbackMessage = 'Request failed'}) → KoolbaseException
dependency at its core while koolbaseDataErrorFromResponse offers a convenience wrapper.
koolbaseDataErrorFromResponse(Response res, {String fallbackMessage = 'Request failed'}) → KoolbaseException
Convenience wrapper over koolbaseDataError that decodes the response body for you. Use at call sites that have the raw http.Response.
koolbaseDataErrorNotifying(Response res, {String fallbackMessage = 'Request failed', Future<void> onSessionExpired()?}) → Future<KoolbaseException>
Builds the exception for a failed response and notifies onSessionExpired when the server rejected the session token itself.
koolbaseStorageError(int statusCode, Map<String, dynamic> body, {String fallbackMessage = 'Storage request failed'}) → KoolbaseException
Maps a non-2xx storage-layer response to a typed KoolbaseStorageException, preferring the server's stable code and falling back to the HTTP status for older or uncoded responses. The caller decodes the body once and passes (statusCode, body); this keeps the mapper free of an http dependency at its core while koolbaseStorageErrorFromResponse offers a convenience wrapper.
koolbaseStorageErrorFromResponse(Response res, {String fallbackMessage = 'Storage request failed'}) → KoolbaseException
Convenience wrapper over koolbaseStorageError that decodes the response body for you. Use at call sites that have the raw http.Response.
refreshAllCollectionStreams() → Future<void>
Refreshes every open query, on every collection.
refreshCollectionStreams(String collection) → Future<void>
Refreshes every open query on a collection, after a write.

Typedefs

KoolbaseQueryBuilder = KoolbaseQuery Function(KoolbaseQuery query)
Configures a fresh base query for one fetch. Called every time the component fetches or refreshes — never with a reused instance.
MandatoryUpdateCallback = void Function(MandatoryUpdateInfo info)
RealtimeConnector = RealtimeConnection Function(Uri uri)
Opens a RealtimeConnection to uri. The default is a WebSocket.

Exceptions / Errors

AccountExistsException
An OAuth sign-in for an email that already has an account by another method. Sign in the existing way first, then connect the provider.
AccountLockedException
Thrown when the account is temporarily locked due to too many failed login attempts (brute-force protection). The server uses progressive 5/10/20-attempt lockouts; if an unlock email was issued (level 2+), the user can clear the lock by clicking that link, which calls KoolbaseAuthClient.unlock with the token.
AppleEmailRequiredException
AppleSignInNotConfiguredException
ContactNotVerifiedException
Thrown when a project requires a verified contact channel and the account has none. The credentials were CORRECT — the project's policy refused.
EmailAlreadyInUseException
EmailCodeDisabledException
The project has switched off signing in with an emailed code — 403 email_code_disabled. Applies to every address alike, so it reveals nothing about which accounts exist.
FiscalException
Thrown when a fiscal operation fails for non-auth reasons: network errors, malformed responses, or server-side refusals. Carries the HTTP status when one was received.
FunctionExecutionException
FunctionInvokeException
Exception thrown when a function invocation fails. A Function call did not succeed.
FunctionNotFoundException
No Function by that name is deployed to this project.
FunctionPermissionException
The caller may not invoke this Function.
FunctionQuotaExceededException
The project has used up its Function invocations for the period.
FunctionRateLimitException
Too many invocations, too fast. Distinct from a quota being spent: this one clears by waiting.
FunctionTimeoutException
The Function ran and failed.
FunctionValidationException
The Function rejected its arguments.
GoogleEmailRequiredException
GoogleSignInNotConfiguredException
HideRequiresVerificationException
Hiding account existence needs verified contact on; the project has it off. A settings-validation refusal, not a user error.
IdentityNotFoundException
The provider is not connected to this account.
InsufficientScopeException
The API key's scope is below what the operation requires. Scopes rank read < write < admin. The key is valid — a different key or a dashboard session is needed, so do not tell the user to sign in again.
InvalidAppleTokenException
InvalidCredentialsException
InvalidGoogleTokenException
InvalidPasswordException
The current password given to changePassword did not match, or the account signed up through a provider and has no password to change. The server returns the same code for both so a caller cannot probe which sign-in methods an account has.
InvalidPhoneNumberException
KoolbaseAmbiguousMatchException
Thrown when a write was refused because the record changed since it was composed.
KoolbaseAuthException
Something went wrong signing in, signing up, or maintaining a session.
KoolbaseBatchFailedException
A batch write failed for a reason the server did not classify further.
KoolbaseCapBelowUsageException
A bucket cap set below what the bucket already holds. A dashboard operation, mapped so it does not arrive untyped.
KoolbaseCollectionReferencedException
Thrown when a collection cannot be deleted because another collection has a reference field pointing at it — 409 collection_referenced. Remove that reference first.
KoolbaseConflictException
KoolbaseConstraintExistsException
A unique constraint already covers those fields.
KoolbaseConstraintNotFoundException
No such unique constraint.
KoolbaseDanglingReferencesException
Thrown when a reference cannot be declared because existing records already point at records that do not exist — 409 dangling_references.
KoolbaseDataException
Base class for errors surfaced by the Koolbase data layer (database reads and writes). Every data error carries a human-readable message and, when the server provides one, its stable code (e.g. not_found, validation_error, unique_violation).
KoolbaseDuplicateValuesException
Creating a unique constraint over data that already breaks it. The server's details carry the offending values.
KoolbaseException
The root of every error the SDK raises.
KoolbaseFieldNotAutoEmbedException
A backfill was asked for on a field that embeds nothing automatically.
KoolbaseIdempotencyKeyReusedException
The same idempotency key sent with different data. Refused rather than replayed: the two requests do not agree, so neither answer is safe.
KoolbaseInsufficientAuthorityException
Authenticated, and not permitted to do this — a destructive operation such as a seed overwrite or a snapshot restore. Distinct from KoolbasePermissionException, which is a rule denying a record.
KoolbaseInvalidBodyException
The request body could not be decoded.
KoolbaseInvalidEmbeddingConfigException
Embedding config is partial. Provider, model and source_field are set together or cleared together.
KoolbaseInvitationInvalidException
An invitation that has been revoked or has expired.
KoolbaseNoChangesException
The request asked for no change.
KoolbaseNotFoundException
Thrown when the requested record or collection does not exist — the server responds with 404 and code not_found / record_not_found / collection_not_found.
KoolbaseOfflineBaselineUnavailableException
Maps a non-2xx data-layer response to a typed KoolbaseDataException, preferring the server's stable code and falling back to the HTTP status for older or uncoded responses. The caller decodes the body once and passes (statusCode, body); this keeps the mapper free of an http Thrown when the server rejects the session token itself — expired, revoked, or belonging to a different project than the one this app is configured for.
KoolbasePermissionException
Thrown when the caller is authenticated but not allowed to perform the operation — the server responds with 403 and code permission_denied (typically a collection access rule rejecting the write/read).
KoolbasePlanLimitException
The project's plan does not allow this — a 402 carrying which resource, the limit, and the plan.
KoolbaseProjectInvalidException
The project id in the request is not valid.
KoolbaseProviderInvalidException
The configured provider's credentials were rejected by the provider.
KoolbaseProviderNotConfiguredException
The project has no embedding provider configured.
KoolbaseRateLimitException
Thrown when the server is rate-limiting the caller — 429 with code rate_limit. Back off and retry after a short delay.
KoolbaseReferenceInUseException
Thrown when a record cannot be deleted because live records still reference it, under a reference declared on_delete: restrict — 409 reference_in_use.
KoolbaseReferenceInvalidException
Thrown when a write (insert, update, or upsert) is rejected because the value would violate a collection's unique constraint — the server responds with 409 Conflict and code unique_violation. Catch this to handle duplicates, e.g. an email or username that's already taken.
KoolbaseRevisionMismatchException
KoolbaseSeedException
A seed or import operation was refused. code says which stage: invalid_seed_file, seed_key_not_unique, seed_needs_decision, or seed_conflicts_require_force. One class rather than four: these are dashboard and CLI operations, and a caller handles them the same way — show the reason and let a human decide.
KoolbaseSessionExpiredException
KoolbaseSlugTakenException
A project slug that another project already holds.
KoolbaseStateConflictException
Something already exists, or is in the wrong state, where the server did not say more. code is whichever generic code arrived.
KoolbaseStorageConflictException
Thrown when an upload is rejected because an object already exists at the requested path — the server responds with 409 Conflict and code path_conflict. Catch this to give the user an "overwrite this file?" prompt, then retry the upload with overwrite: true.
KoolbaseStorageException
Base class for errors surfaced by the Koolbase storage layer (uploads, downloads, deletes, and bucket/object operations). Every storage error carries a human-readable message and, when the server provides one, its stable code (e.g. path_conflict).
KoolbaseStorageFileTooLargeException
Thrown when a single file exceeds the bucket's configured max_file_size_bytes — the server responds with 413 Payload Too Large and code file_too_large. The server cleans up the underlying R2 object before returning. The configured per-file limit lives on the bucket record; check Bucket.maxFileSizeBytes to surface a clear "files must be under X MB" message at the call site.
KoolbaseStorageMetadataInvalidException
Thrown when an object metadata payload (either at upload-confirm time or via updateMetadata) fails server-side validation — the server responds with 400 and code metadata_invalid.
KoolbaseStorageMimeTypeException
Thrown when an upload's content-type isn't in the bucket's configured allowed_mime_types allowlist — the server responds with 415 Unsupported Media Type and code mime_not_allowed. The check runs at presign time, so no bytes are transferred before rejection.
KoolbaseStorageNotFoundException
Thrown when the requested bucket or object does not exist — the server responds with 404. Also surfaced for cross-tenant access attempts (Koolbase's 404-over-403 convention prevents enumeration in multi-tenant contexts).
KoolbaseStoragePermissionException
Thrown when the caller is authenticated but not allowed to perform the storage operation — the server responds with 403.
KoolbaseStorageProjectIdentityException
Thrown by KoolbaseStorageClient.publicUrlFor when the SDK has not yet learned which project it belongs to. Project identity arrives with the bootstrap payload (and persists in its cache); it is unavailable when the very first bootstrap has not completed — a fresh install starting offline — or when the server predates identity metadata.
KoolbaseStorageQuotaExceededException
KoolbaseStorageValidationException
Thrown when the request is rejected as invalid — the server responds with 400 (e.g. a malformed path, missing field, invalid bucket name).
KoolbaseUnauthenticatedException
The server would not accept the caller's credentials.
KoolbaseUploadExpiredException
Thrown when an upload would push the bucket past its configured max_size_bytes quota — the server responds with 409 Conflict and code quota_exceeded. The server cleans up the underlying R2 object before returning; nothing leaks. Catch this to surface a "bucket is full" message or prompt the caller to delete older files. The per-bucket quota is set at bucket creation time and is currently immutable.
KoolbaseUploadURLFailedException
Minting a presigned upload URL failed. Not the user's doing and not a retry they can fix — distinct from KoolbaseUploadExpiredException, which is a retry that will work.
KoolbaseValidationException
Thrown when the request is rejected as invalid — the server responds with 400 and code validation_error (e.g. a malformed body or a bad field).
KoolbaseVectorDimensionMismatchException
Thrown when the supplied vector's length does not match the dimension declared on the collection's vector field — the server responds with 400 and code vector_dimension_mismatch. The message includes both the expected and actual dimensions so you can surface a precise error.
KoolbaseVectorFieldExistsException
A vector field with that name already exists on the collection.
LastCredentialException
Refused because it would remove the account's last way of signing in.
MfaAlreadyEnabledException
MfaEnrollmentNotFoundException
No enrolment in progress, or it expired after 15 minutes. Start again.
MfaNotEnabledException
MfaRequiredException
The first factor passed, and this account needs a second: sign-in is not finished. Pass challengeToken to verifyMfa with a code from the person's authenticator app, or to verifyRecoveryCode. Apps that never enable MFA never see this.
NetworkException
OAuthEmailConflictException
OAuthOnlyAccountException
A password attempt against an account that only has Google or Apple.
OtpExpiredException
OtpInvalidException
OtpMaxAttemptsException
OtpRateLimitException
PhoneAlreadyLinkedException
ProviderIdentityAlreadyLinkedException
Connecting a Google or Apple identity that another account already holds. About the provider identity itself, where AccountExistsException is about the email.
RateLimitException
Thrown when the server rate-limits a non-phone authentication endpoint (HTTP 429 without the "account temporarily locked" marker). Phone OTP endpoints throw OtpRateLimitException instead — they have a separate rate-limiter on the server.
RecentAuthRequiredException
Starting MFA needs a sign-in within the last ten minutes. Sign in again.
RecentMfaRequiredException
Changing MFA needs a second factor confirmed in the last ten minutes. Call stepUpMfa with a code, then retry.
ResendCooldownException
Thrown by KoolbaseAuthClient.resendVerificationEmail when a resend is requested during the cooldown window. Recoverable — retry after the cooldown (see ResendVerificationResult.cooldownUntil from a successful send for the countdown).
ResendDailyCapException
Thrown by KoolbaseAuthClient.resendVerificationEmail when the daily verification-email limit has been reached. Not recoverable until the 24-hour window rolls over.
SessionExpiredException
SessionRequiredException
The call needs a signed-in user and did not have one.
SignupsDisabledException
The project has registration turned off. Not a credential problem.
SmsConfigMissingException
TokenAlreadyUsedException
A one-shot link clicked twice.
TokenExpiredException
A verification or reset link that has expired. Request another.
TokenRevokedException
Thrown when the access token references a session that has been revoked centrally — either by the user (via the sessions endpoint) or by an administrator. Distinct from SessionExpiredException which indicates the access token TTL elapsed without a successful refresh.
UnlockTokenInvalidException
Thrown when the unlock token (from a brute-force unlock email) is invalid or expired. Unlock tokens are one-shot — once consumed, the same token can't be reused.
UnsupportedOAuthProviderException
A provider the project has not enabled.
UserDisabledException
WeakPasswordException