SDK entry point (initialize and connect)
Use the static AzeooSDK class: initialize once, then connect when the user is authenticated.
initialize
static Future<void> initialize(
String apiKey, {
AzeooSDKInitOptions? options,
})
Initializes the SDK with your API key and optional options (locale, theme, deepLinks, safeArea, analyticsEnabled, offlineSupport). Call once at app startup (or after bootstrap). No user is attached yet.
connect
static Future<void> connect(String userId, String token)
Attaches an authenticated user. Must be called before using AzeooSDK.nutrition, AzeooSDK.training, or AzeooSDK.config. Pass the user's ID and auth token (e.g. from your auth provider).
disconnect
static Future<void> disconnect()
Clears the current user and session. The SDK remains initialized; you can call connect again with another user.
Status
- AzeooSDK.isInitialized — Whether initialize has been called.
- AzeooSDK.isConnected — Whether connect has been called and user is attached.
- AzeooSDK.userId — Current user ID (null if not connected).
- AzeooSDK.user — User API (use after connect).
- AzeooSDK.config — Current UI config (after connect).
Example
await AzeooSDK.initialize('your-api-key', options: AzeooSDKInitOptions(
locale: 'en',
analyticsEnabled: true,
offlineSupport: true,
));
await AzeooSDK.connect('user-123', 'jwt-token');
// Use AzeooSDK.nutrition, AzeooSDK.training, AzeooSDKContent...
await AzeooSDK.disconnect();