core library
Shotik core: configuration, identity storage, transport (dart:io HttpClient and WebSocket), backoff and the app root widget. Support and Analytics build on it; import only the libraries your app uses.
Classes
- ErasableAnalytics
- An install's analytics as Delete my data sees it: forget() asks the server to delete the install and starts a new one; reset() starts a new one when forget could not reach the server.
- FileStorage
- HealthFilter
-
Tap and rage labels (after redaction) that contain a health term become "
health". HEALTH_TERMS is always on;extraadds app terms under the same rules. Element ids are not touched. - HttpTransport
- MemoryStorage
- Shotik
- ShotikConfig
- ShotikDevice
- ShotikNative
- ShotikResponse
- ShotikRoot
- ShotikRootState
- ShotikSocket
- ShotikStorage
- ShotikTransport
Constants
- DEFAULT_SERVER → const String
-
HEALTH_TERMS
→ const List<
String>
Functions
-
flushInterval(
int flushMs, int backoff) → Duration - Analytics flush interval: flushMs × 2^backoff, backoff capped at 5.
-
healthPattern(
[List< String> extra = const []]) → RegExp - The filter as one regex: HEALTH_TERMS plus the app's healthTerms, matched against the lowercased label.
-
localId(
String prefix) → String - prefix + time in base 36 + 8 random characters, like the reference's localId().
-
reconnectDelay(
int n, [Random? random]) → Duration - Reconnect delay: min(30 s, 500 ms × 2^n) × uniform(0.8, 1.2), n = consecutive failures.
-
resolveServer(
String? url, {bool release = kReleaseMode}) → String? -
The base URL to use, or null when nothing may be sent. Trailing slashes are removed. An empty URL, or in a release
build (not
release== false) plain http to a host outside loopback, *.local, 10/8, 172.16/12, 192.168/16, 169.254/16 and fc00::/7, sends nothing and warns once. https is always allowed; debug builds allow anything. -
retryAfter(
int status, Map< String, String> headers, DateTime now) → Duration? - How long a 429 or 503 asks the client to wait (Retry-After in seconds or as an HTTP date), capped at 1 h; null when the status is another one or the header is missing or unreadable (the caller then uses its normal backoff).
-
retryDelay(
int attempts) → Duration - Send retry delay: min(30 s, 500 ms × 2^attempts).