client/server library

Classes

ApiCache
Two-level cache for GET responses.
ApiClient
Singleton Dio instance factory. One instance per ApiVersion — all share the same auth strategy and cookie jar. Instances are cached so repeated access is free.
ApiEnvelope
ApiError<T>
A failed API response.
ApiGetRequestOptions
ApiKeyStrategy
Attaches a static API key to every request as an x-api-key header. The key is a compile-time constant — never stored dynamically.
ApiNotifier
ApiRequest<T>
ApiRequestOptions
ApiResult<T>
The result of every API call — success or error. Never throws. Screens pattern-match on this.
ApiSuccess<T>
A successful API response.
AuthEvents
AuthStrategy
Base auth strategy. Implement to add custom auth behaviour. The ApiClient calls apply before every non-noAuth request.
BearerStrategy
Reads the JWT access token from memory (fast) with a Hive fallback (persistent). Attaches it as Authorization: Bearer <token>.
CookieChangedEvent
Emitted whenever any cookie is added or updated.
CookieEvents
Central event bus for all cookie activity. Screens and providers can listen to any stream here.
CookieManager
Wraps Dio's PersistCookieJar with helper methods and event emission.
CookiesClearedEvent
Emitted when all cookies are cleared.
CookieStrategy
Relies on Dio's CookieJar to attach cookies automatically. No manual header injection needed — the CookieJar intercepts every request.
DeleteRequest<T>
ForbiddenEvent
Emitted when the server returns 403.
GetRequest<T>
PatchRequest<T>
PostRequest<T>
PutRequest<T>
Server
ServerConfig
App-level constants for the server layer. Override these at Server.init — they are not compile-time constants so they can be set from environment config or flavor files.
UnauthorizedEvent
Emitted when the server returns 401 — app should refresh token or logout.
UploadFile
Describes a single file to be uploaded.
UploadNotifier
UploadProgress
Snapshot of an in-progress upload.
UploadRequest<T>

Enums

UploadMethod

Properties

apiProvider → StateNotifierProvider<ApiNotifier, AsyncValue<ApiResult>>
Single API notifier. One instance per screen via apiProvider.family or shared globally — your choice.
final
uploadProgressStreamProvider → StreamProvider<UploadProgress>
Watch this stream to show a real-time upload progress bar.
final
uploadProvider → StateNotifierProvider<UploadNotifier, AsyncValue<ApiResult>>
State: the result of the last upload (or null if none yet).
final