The Day.io SDK - one per app, nothing to create or keep, like the native DaySdk. Set it up once
when your app starts with initialize (it makes no network calls). Then, after the employee
signs in to your app:
- start with a one-time token from your backend on the first run, or when your re-authentication rule says so (see lastAuthenticatedAt);
- resume otherwise, to continue with the session already on the device.
Once either reports DaySdkReady, show DaySdkAttendance. Call signOut when the employee signs out of your app. None of the methods throw: a platform error comes back as DaySdkFailed.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
isOnline
→ Stream<
bool> -
Live internet connectivity - the current value first. The SDK screens already show an offline
banner; use it for one of your own.
no setter
-
lastAuthenticatedAt
→ Future<
DateTime?> -
When the employee last authenticated with Day.io through start, or null if they never did
on this device (or Day.io rejected the session since). Use it for your own re-authentication
rule, e.g. "call start if null or older than 30 days, otherwise resume".
no setter
-
state
→ Stream<
DaySdkState> -
The SDK's state as it changes - the current one first: DaySdkIdle until start / resume
and after signOut, DaySdkStarting while they run, then their outcome, and
DaySdkSessionInvalid when Day.io rejects the session later.
no setter
Static Methods
-
initialize(
{required DayEnvironment environment, void onSessionInvalid()?}) → Future< void> - Sets up the Day.io SDK - call it once, when your app starts, before anything else here. A second call keeps the first setup.
-
resume(
) → Future< DaySdkState> - Continues with the session already on the device and loads the employee's profile, with no authentication call. Works offline.
-
setGoogleMapsApiKey(
String key) → Future< void> -
iOS only. Your Google Maps key for the SDK's maps, when your app gets it at runtime. It wins
over the
DaySdkGoogleMapsApiKeyInfo.plist entry. Android always uses thecom.google.android.geo.API_KEYentry of your manifest; this does nothing there. -
setLanguage(
String? languageTag) → Future< void> -
Sets the language of the SDK's screens and of what Day.io's API returns to them, as a BCP 47
tag such as
'en','pt-BR'or'es-MX'('pt_BR'works too). It wins over the device language and applies right away, also to screens already showing. A language the SDK has no translation for shows in English. -
signOut(
) → Future< void> - Signs the employee out of Day.io and removes the session from the device. The employee's data stays on the device (encrypted) for their next start.
-
start(
String exchangeToken) → Future< DaySdkState> -
Authenticates the employee with Day.io and loads their profile, after they signed in to your
app.
exchangeTokencomes from your backend, works once and expires soon - never log or store it.