Flutter Integration
Recommended patterns for integrating the Eixam SDK into your Flutter host app.
Recommended pattern
Create one SDK instance during app bootstrap and inject it into your app state or dependency container:
class AppBootstrapper {
Future<EixamConnectSdk> createSdk(EixamSession session) {
return EixamConnectSdk.bootstrap(
EixamBootstrapConfig(
appId: session.appId,
environment: EixamEnvironment.sandbox,
initialSession: session,
),
);
}
}
Thin host-app rule
Keep your host app thin. The SDK owns the core safety and runtime logic — your app owns UX and navigation.
Your host app should:
- Own UX and navigation
- Request permissions intentionally
- Subscribe to SDK streams
- Call SDK methods
Your host app should not:
- Recreate backend operational logic already owned by the SDK
- Parse BLE protocol directly in widgets
- Hardcode transport or topic logic
Session refresh
When a user logs in or out, update the session explicitly:
await sdk.setSession(
const EixamSession.signed(
appId: 'partner-app',
externalUserId: 'partner-user-123',
userHash: 'signed-session-hash-rotated',
),
);
await sdk.refreshCanonicalIdentity();
Lifecycle recommendations
- Bootstrap once per app start
- Keep one live SDK instance — do not rebuild it for ordinary UX events
- Update the session explicitly when login or logout changes the identity