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({
required String token,
required String gender,
required Height height,
required Weight weight,
})
Attaches an authenticated user. Must be called before using AzeooSDKModules.nutrition or AzeooSDK.config.
Pass your user JWT token plus user profile basics (gender, height, weight).
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β
import 'package:azeoo_sdk/azeoo_sdk.dart';
await AzeooSDK.initialize('your-api-key', options: AzeooSDKInitOptions(
locale: 'en',
analyticsEnabled: true,
offlineSupport: true,
));
await AzeooSDK.connect(
token: 'userToken',
gender: 'male',
height: Height(178),
weight: Weight(75),
);
// Use AzeooSDKModules.nutrition, AzeooSDKContent...
await AzeooSDK.disconnect();