siyak_flutter library

SIYAK — context-aware translation for Flutter apps.

A thin client for the Siyak API: one synchronous, cache-first t() that never blocks a frame, background batch fetching, a persistent LRU cache, and typed failures that park instead of hammering a metered connection.

final siyak = Siyak.init(
  apiKey: 'sk_test_…',
  endpoint: 'https://translate.yourapp.eg', // required: no host ships in the SDK
  target: 'ar-EG',
);
Text(siyak.t('Save'))

Classes

CacheStore
Reads and writes the cached translation blob for a namespace.
InMemoryCacheStore
Keeps the cache in this isolate only.
SharedPreferencesCacheStore
Persists the blob through shared_preferences.
Siyak
A context-aware translation client for Flutter.

Constants

rtlLanguageTags → const Set<String>
Language tags the SDK treats as right-to-left, by primary subtag.

Functions

isRtlTag(String tag) → bool
Whether tag is right-to-left, ignoring any region subtag (ar-EG → rtl).

Typedefs

SiyakLog = void Function(String message)
Sink for SDK diagnostics. See the onLog argument of Siyak.init.

Exceptions / Errors

BackendUnavailableException
503 backend_unavailable — the model is down.
InvalidApiKeyException
401 invalid_api_key — bad format, revoked key, or inactive project.
InvalidRequestException
400 invalid_request — a rejected language tag, context, or oversized text.
OriginNotAllowedException
403 origin_not_allowed — only reachable from a browser or web view, since a native app sends no Origin header and the Worker allows its absence.
QuotaExceededException
402 quota_exceeded — the monthly character budget is spent.
RateLimitedException
429 rate_limited — the plan's requests-per-minute window is full.
SiyakException
Base class for everything the SDK can throw or report.
SiyakNetworkException
No HTTP answer at all: socket failure, DNS error, timeout, or a body that is not the JSON the Worker documents.
SiyakNotInitializedException
Thrown by Siyak.shared when Siyak.init has not run yet.